# Call-to-Action (CTA) Guidelines This document outlines the standardized patterns for buttons, links, and action elements in ThrillWiki. ## Button Hierarchy ### Primary Actions Use for the main action on a page or in a section: ```html Create New ``` **When to use:** - Form submissions - Main page actions - Completing a flow ### Secondary Actions Use for important but non-primary actions: ```html ``` **When to use:** - Alternative actions - Non-destructive secondary options - Cancel with importance ### Tertiary Actions Use for low-emphasis actions: ```html Go Back ``` **When to use:** - Cancel buttons - Navigation links - Dismissive actions ### Destructive Actions Use for actions that delete or remove data: ```html ``` **When to use:** - Delete operations - Remove actions - Destructive confirmations ## Button Sizes ```html ``` ## Button States ### Loading State ```html ``` ### Disabled State ```html ``` ### With Icon ```html ``` ## Action Bar Component Use the action bar for consistent button placement: ```django {% include 'components/ui/action_bar.html' with primary_action_text='Save Changes' primary_action_icon='fas fa-save' secondary_action_text='Preview' tertiary_action_text='Cancel' tertiary_action_url='/parks/' %} ``` ### Alignment Options ```django {# Right-aligned (default) #} {% include 'components/ui/action_bar.html' with align='right' ... %} {# Left-aligned #} {% include 'components/ui/action_bar.html' with align='left' ... %} {# Space-between (cancel left, actions right) #} {% include 'components/ui/action_bar.html' with align='between' ... %} {# Center-aligned #} {% include 'components/ui/action_bar.html' with align='center' ... %} ``` ## Placement Guidelines ### Page Headers Primary CTA in page header, aligned right: ```django {% include 'components/layout/page_header.html' with title='Parks' primary_action_url='/parks/create/' primary_action_text='Add Park' primary_action_icon='fas fa-plus' %} ``` ### Card Actions Actions in card footer, right-aligned: ```html
``` ### Form Actions Form buttons at bottom, with cancel on left or right based on flow: ```html
Cancel
``` ### Modal Actions Actions in modal footer, right-aligned: ```html ``` ### Inline Actions For table rows or list items: ```html
``` ## Link vs Button ### Use Links For: - Navigation to other pages - Opening in new tabs - Bookmarkable destinations ```html View Park ``` ### Use Buttons For: - Form submissions - JavaScript actions - State changes - Toggles ```html ``` ## Icon Guidelines ### Icon Position - **Left icon**: For actions (Add, Create, Save) - **Right icon**: For navigation (Next, Go, External link) ```html Next Step ``` ### Common Icon Mappings | Action | Icon | |--------|------| | Create/Add | `fa-plus` | | Edit | `fa-edit` or `fa-pen` | | Delete | `fa-trash` | | Save | `fa-save` | | Cancel | `fa-times` | | Search | `fa-search` | | Filter | `fa-filter` | | Download | `fa-download` | | Upload | `fa-upload` | | Settings | `fa-cog` | | Back | `fa-arrow-left` | | Next | `fa-arrow-right` | | External Link | `fa-external-link-alt` | ## Confirmation Patterns ### Inline Confirmation (Low Risk) ```html ``` ### Modal Confirmation (High Risk) ```django {% include 'components/modals/modal_confirm.html' with modal_id='delete-confirm' show_var='showDeleteModal' title='Delete Park' message='This will permanently delete the park and all associated data. This action cannot be undone.' confirm_text='Delete' confirm_variant='destructive' confirm_hx_delete='/parks/123/' %} ``` ## Responsive Behavior ### Mobile Stacking Buttons stack vertically on mobile: ```html
``` ### Icon-Only on Mobile ```html ``` ### Full-Width on Mobile ```html ``` ## Accessibility ### Button Labels Always provide accessible labels: ```html ``` ### Focus States All buttons must have visible focus states: ```css .btn:focus { outline: none; ring: 2px; ring-offset: 2px; ring-color: var(--ring); } ``` ### Keyboard Navigation Ensure buttons are keyboard accessible: ```html
Click Me
``` ## HTMX Integration ### Loading Indicators Show loading state during requests: ```html ``` ### Disable During Request ```html ``` ### Success Feedback ```python # In view from apps.core.htmx_utils import htmx_success def save_item(request): # ... save logic ... return htmx_success('Item saved successfully!') ```