@cognite/aura 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/DESIGN.md +1517 -2
  2. package/README.md +21 -0
  3. package/dist/components/index.d.ts +2 -2
  4. package/dist/components/index.js +37 -35
  5. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +64 -75
  6. package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +1 -2
  7. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +38 -49
  8. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +64 -75
  9. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +1 -2
  10. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +51 -64
  11. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +146 -161
  12. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +1 -2
  13. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +124 -137
  14. package/dist/components/ui/core/date-time-pickers/index.d.ts +2 -0
  15. package/dist/components/ui/core/date-time-pickers/index.js +6 -4
  16. package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +8 -8
  17. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +1 -1
  18. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +1 -1
  19. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +0 -2
  20. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +18 -34
  21. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -0
  22. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +19 -0
  23. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +41 -0
  24. package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -0
  25. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +16 -0
  26. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +100 -0
  27. package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +23 -0
  28. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +3 -0
  29. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +64 -0
  30. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +17 -15
  31. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +83 -85
  32. package/dist/lib/use-controllable-state.js +17 -17
  33. package/dist/styles.css +1 -1
  34. package/package.json +1 -1
package/DESIGN.md CHANGED
@@ -462,6 +462,240 @@ Width and spacing values in this subsection follow the **`{spacing.base}`-based*
462
462
  - **Must** apply that limit to the **text column only** — companion UI (icons, thumbnails, side metadata, charts, code blocks) **may** sit outside that `{spacing.prose-max}` band in the same row or card; do not shrink the text measure to absorb those elements.
463
463
  - **Should** implement the cap with `max-w-[{spacing.prose-max}]` / `max-w-[37.5rem]` (or an equivalent layout wrapper) on the text block, not by stretching typography alone inside an arbitrarily wide container.
464
464
 
465
+ Standard layout primitives used across all patterns:
466
+
467
+ **Content max widths**
468
+ - max-w-7xl — dashboards, full-width layouts
469
+ - max-w-4xl — detail pages
470
+ - max-w-2xl — forms, wizard step content
471
+ - max-w-sm — search inputs, narrow controls
472
+
473
+ **Section spacing**
474
+ - space-y-8 — between major page sections (e.g. form groups)
475
+ - space-y-6 — between sections within a page
476
+ - space-y-4 — between items within a section
477
+ - space-y-2 — between label and field, tight groupings
478
+
479
+ **Grid gaps**
480
+ - gap-6 — dashboard grids, chart grids, panel gaps
481
+ - gap-4 — card grids, metric grids
482
+ - gap-3 — toolbar items, button groups
483
+
484
+ **Page padding**
485
+ - px-6 py-8 — standard content area (desktop)
486
+ - px-4 py-6 — mobile content area
487
+ - p-4 — card/panel internal padding
488
+ - p-6 — larger card internal padding
489
+
490
+ ### Layout patterns
491
+
492
+ #### Sidebar content
493
+ 3+ top-level sections. Persistent navigation needed.
494
+ Most common for multi-page apps.
495
+
496
+ **Structure**
497
+
498
+ ```
499
+ ┌──────────┬─────────────────────────────┐
500
+ │ │ Page Header / Breadcrumb │
501
+ │ Sidebar │─────────────────────────────│
502
+ │ Nav │ │
503
+ │ (dark) │ Main Content Area │
504
+ │ │ (bg-background) │
505
+ │ │ │
506
+ └──────────┴─────────────────────────────┘
507
+ ```
508
+
509
+ **Responsive behavior**
510
+ Desktop (1440px+): Sidebar 240px, content fills rest.
511
+ Tablet (768px-1439px): Sidebar collapsible via hamburger.
512
+ Mobile (below 768px): Sidebar hidden. Hamburger menu.
513
+ Consider bottom nav for 3-5 primary sections.
514
+
515
+ #### Full-width dashboard
516
+ Data visualizations, metrics, monitoring. Maximum horizontal space needed.
517
+
518
+ **Structure**
519
+
520
+ ```
521
+ ┌─────────────────────────────────────────┐
522
+ │ Top Navigation Bar │
523
+ ├─────────────────────────────────────────┤
524
+ │ Page Header + Filters │
525
+ ├─────────────────────────────────────────┤
526
+ │ ┌───────┐ ┌───────┐ ┌───────┐ │
527
+ │ │Metric │ │Metric │ │Metric │ │
528
+ │ └───────┘ └───────┘ └───────┘ │
529
+ ├─────────────────────────────────────────┤
530
+ │ Charts / Visualizations │
531
+ ├─────────────────────────────────────────┤
532
+ │ Data Table │
533
+ └─────────────────────────────────────────┘
534
+ ```
535
+
536
+ **Responsive behavior**
537
+ Desktop: Multi-column grid (grid-cols-3 or grid-cols-4).
538
+ Tablet: 2-column grid. Charts stack.
539
+ Mobile: Single column. Metrics as horizontal scroll.
540
+
541
+ #### Form page
542
+ Data entry, creation flows, configuration, settings with form fields.
543
+
544
+ **Structure**
545
+
546
+ ```
547
+ ┌─────────────────────────────────────────┐
548
+ │ Page Header + Back navigation │
549
+ ├─────────────────────────────────────────┤
550
+ │ ┌───────────────────────────────┐ │
551
+ │ │ Form Section 1 (heading) │ │
552
+ │ │ [fields] │ │
553
+ │ ├───────────────────────────────┤ │
554
+ │ │ Form Section 2 (heading) │ │
555
+ │ │ [fields] │ │
556
+ │ └───────────────────────────────┘ │
557
+ ├─────────────────────────────────────────┤
558
+ │ Sticky footer: [Cancel] [Save action] │
559
+ └─────────────────────────────────────────┘
560
+ ```
561
+
562
+ **Responsive behavior**
563
+ Desktop: Form centered, max-w-2xl (672px) or max-w-3xl.
564
+ Tablet: Form fills width with px-6 padding.
565
+ Mobile: Full width. Sticky footer stays. Fields stack.
566
+
567
+ #### Detail page
568
+
569
+ Viewing a single record: report details, user profile, item information with related data.
570
+
571
+ **Structure**
572
+
573
+ ```
574
+ ┌─────────────────────────────────────────┐
575
+ │ Breadcrumb: Reports > Q2 Summary │
576
+ ├─────────────────────────────────────────┤
577
+ │ Record Header [Title, status, actions] │
578
+ ├─────────────────────────────────────────┤
579
+ │ ┌─────────────────┬───────────────┐ │
580
+ │ │ Main Content │ Sidebar │ │
581
+ │ │ (2/3 width) │ (1/3 width) │ │
582
+ │ └─────────────────┴───────────────┘ │
583
+ └─────────────────────────────────────────┘
584
+ ```
585
+
586
+ **Responsive behavior**
587
+ Desktop: Two-column (grid-cols-3, main span-2, sidebar span-1).
588
+ Tablet: Sidebar below main content.
589
+ Mobile: Single column. Sidebar collapses.
590
+
591
+
592
+ #### Settings page
593
+ App preferences, account settings, notification config.
594
+
595
+ **Structure**
596
+
597
+ ```
598
+ ┌─────────────────────────────────────────┐
599
+ │ Page Header: Settings │
600
+ ├───────────┬─────────────────────────────┤
601
+ │ Settings │ Section Content │
602
+ │ Nav │ [Form fields / toggles] │
603
+ └───────────┴─────────────────────────────┘
604
+ ```
605
+
606
+ **Responsive behavior**
607
+ Desktop: Left nav + content area.
608
+ Tablet: Top tabs replacing left nav.
609
+ Mobile: Category list → tap opens section full-screen.
610
+
611
+ #### Split screen
612
+ Comparison views, editor + preview, master-detail with equal emphasis on both sides.
613
+
614
+ **Structure**
615
+
616
+ ```
617
+ ┌─────────────────────┬─────────────────────┐
618
+ │ │ │
619
+ │ Panel Left │ Panel Right │
620
+ │ (1/2 width) │ (1/2 width) │
621
+ │ │ │
622
+ └─────────────────────┴─────────────────────┘
623
+ ```
624
+
625
+ **Responsive behavior**
626
+ Desktop: grid-cols-2, equal columns.
627
+ Tablet: grid-cols-2 with narrower gap.
628
+ Mobile: Stack vertically (grid-cols-1), or use Segmented Control to switch between panels.
629
+
630
+
631
+ #### Three panel
632
+ Navigation + content + properties panel. IDE-style layouts. Complex editing workflows with context panels.
633
+
634
+ **Structure**
635
+
636
+ ```
637
+ ┌──────────┬───────────────────┬──────────┐
638
+ │ │ │ │
639
+ │ Nav/ │ Main Content │ Props/ │
640
+ │ Tree │ (flexible) │ Detail │
641
+ │ (fixed) │ │ (fixed) │
642
+ │ │ │ │
643
+ └──────────┴───────────────────┴──────────┘
644
+ ```
645
+
646
+ **Responsive behavior**
647
+ Desktop (1440px+): All 3 panels visible.
648
+ Tablet (768-1439px): Hide right panel, toggle via button.
649
+ Mobile (below 768px): Single panel with navigation as Drawer, right panel as bottom sheet or separate route.
650
+
651
+ #### List page
652
+ Browsing collections — reports, users, assets, items. The most common page type in data-heavy applications.
653
+
654
+
655
+ **Structure**
656
+
657
+ ```
658
+ ┌──────────────────────────────────────────┐
659
+ │ Page Header [Title] [Create button] │
660
+ ├──────────────────────────────────────────┤
661
+ │ Filters toolbar [Search] [Filters] │
662
+ ├──────────────────────────────────────────┤
663
+ │ Table / List │
664
+ │ (with empty state when no data) │
665
+ ├──────────────────────────────────────────┤
666
+ │ Pagination │
667
+ └──────────────────────────────────────────┘
668
+ ```
669
+
670
+ **Responsive behavior**
671
+ Desktop: Full table with all columns visible.
672
+ Tablet: Hide non-essential columns, allow horizontal scroll.
673
+ Mobile: Switch to card/list view with stackable filters.
674
+
675
+ #### Wizard
676
+ Multi-step creation flows, onboarding, configuration wizards, setup processes.
677
+
678
+
679
+ **Structure**
680
+
681
+ ```
682
+ ┌──────────────────────────────────────────┐
683
+ │ Step indicator (1 — 2 — 3 — 4) │
684
+ ├──────────────────────────────────────────┤
685
+ │ │
686
+ │ Step Content Area │
687
+ │ (centered, max-w-2xl) │
688
+ │ │
689
+ ├──────────────────────────────────────────┤
690
+ │ [Back] [Next/Submit] │
691
+ └──────────────────────────────────────────┘
692
+ ```
693
+
694
+ **Responsive behavior**
695
+ Desktop: Centered content, horizontal numbered step indicator.
696
+ Tablet: Same layout with px-6 padding.
697
+ Mobile: Step indicator becomes compact ("Step 2 of 4"), content fills width.
698
+
465
699
  ### Size and dimensions
466
700
 
467
701
  Aura aligns to a **`{spacing.base}` base grid**. Spacing in components follows **Tailwind spacing** (`p-*`, `gap-*`, `m-*`): one unit = **`{spacing.base}`** unless overridden. Common steps:
@@ -590,9 +824,9 @@ Aura is visually **flat**; surfaces, spacing, and typography do most structure.
590
824
 
591
825
  ---
592
826
 
593
- ## Components
827
+ ## Primitive components
594
828
 
595
- ### Component heights
829
+ ### Primitive component heights
596
830
 
597
831
  Heights are **not** always single CSS variables; primitives use Tailwind height utilities. Representative values from core components:
598
832
 
@@ -606,6 +840,1199 @@ Heights are **not** always single CSS variables; primitives use Tailwind height
606
840
 
607
841
  **Topbar** height is **application-defined** (not a single Aura token). **Table / list row** density varies by product; menu and command patterns often use **`{components.button-primary.height}`** (`h-9`) rows.
608
842
 
843
+
844
+
845
+ ### Global primitive rules
846
+
847
+ 1. Prefer primitives over custom components.
848
+ 2. Keep behavior accessible (keyboard activation, focus visibility, and clear state changes).
849
+ 3. Do not hide critical information if users need fast comparison or repeated switching.
850
+ 4. When selection is required before action, prefer contextual actions tied to that selection.
851
+ 5. Use Storybook for exact variants, props, and implementation details.
852
+
853
+ ### Primitive guidance
854
+
855
+ Sections are in alphabetical order. For each component, the Storybook link is the primary reference for variants and props; the docs link is the primary reference for usage and design guidance.
856
+
857
+ #### Storybook reference
858
+ Anytime you need to reference a component in Storybook, use the following URL and replace the slug with the component's Storybook slug: https://master--695bb4b1b8041ae09768950a.chromatic.com/?path=/docs/primitives-{storybook-slug}--docs
859
+
860
+ #### Docs reference
861
+ Anytime you need to reference a component in docs, use the following URL and replace the slug with the component's doc slug: https://docs.cognite.com/aura-design-system/primitives/{docs-slug}
862
+
863
+ #### Accordion
864
+
865
+ **Storybook-slug:** accordion
866
+ **Docs-slug:** accordion
867
+
868
+ **Definition**
869
+ Accordion reveals and hides grouped content sections to reduce cognitive load and page density.
870
+
871
+ **Use when**
872
+ - Grouping settings in side/config panels.
873
+ - Breaking long forms into manageable sections.
874
+ - Organizing docs/FAQ/help content.
875
+ - Showing nested information hierarchies.
876
+
877
+ **Use something else when**
878
+ - All content must stay visible for comparison/scanning.
879
+ - Content is short and easy to read without progressive disclosure.
880
+ - Users are making high-stakes or multi-step decisions where hidden content can cause errors.
881
+
882
+ **Dos and don'ts**
883
+ - Do use clear, specific section titles.
884
+ - Do keep icon and heading behavior consistent.
885
+ - Do not use for very short/simple content.
886
+ - Do not nest accordions.
887
+
888
+ **Behavior**
889
+ - Header controls expand/collapse via click/tap/Enter/Space.
890
+ - Support multi-expand unless product pattern requires single-expand.
891
+ - Keep expanded content available to assistive tech.
892
+
893
+ **Often used with**
894
+ - `Separator`, section headings, and form controls inside panel content.
895
+
896
+ #### Action Toolbar
897
+
898
+ **Storybook-slug:** actiontoolbar
899
+ **Docs-slug:** action-toolbar
900
+
901
+ **Definition**
902
+ Action toolbar is a transient bottom-aligned action row that appears when users select items (for example in data-heavy views).
903
+
904
+ **Use when**
905
+ - Actions apply only to selected items.
906
+ - You need to reduce persistent toolbar clutter in tables/lists/cards.
907
+ - The workflow depends on selected state before next actions are valid.
908
+
909
+ **Use something else when**
910
+ - Actions are page-level and do not require selection first (use a standard toolbar/page actions).
911
+
912
+ **Dos and don'ts**
913
+ - Do keep actions contextual to the current selection.
914
+ - Do keep the set focused (use overflow when needed).
915
+ - Do center it in the container/page scope.
916
+ - Do not make it draggable.
917
+
918
+ **Behavior**
919
+ - Hidden by default; appears after selection.
920
+ - Anchored to bottom area; remains until selection clears, action completes, or user navigates away.
921
+ - If no reload occurs, it exits after action completion.
922
+
923
+ **Often used with**
924
+ - Selection patterns in data views, `Checkbox`, `Button`, `Menu`, and `Tooltip` for icon-only actions.
925
+
926
+ #### Alert
927
+
928
+ **Storybook-slug:** alert
929
+ **Docs-slug:** alert
930
+
931
+ **Definition**
932
+ Alert communicates contextual, medium-emphasis information inside page/task flow. It is not a blocking modal.
933
+
934
+ **Use when**
935
+ - Providing inline guidance/recommendations in the current task.
936
+ - Calling attention to warnings/issues that need awareness but are not blocking.
937
+ - Offering direct actions that resolve the issue in context.
938
+
939
+ **Dos and don'ts**
940
+ - Do include action buttons only when actions are directly related to resolving/dismissing the alert.
941
+ - Do evaluate simpler feedback methods first (for example field-level validation).
942
+ - Do not attach unrelated actions.
943
+
944
+ **Placement**
945
+ - Align with surrounding content; do not pin flush against dividers.
946
+ - Use card style for wrapped content in constrained areas.
947
+ - Use strip style for short messages in wider areas.
948
+
949
+ **Behavior**
950
+ - Inline with page flow (not full-screen blocking).
951
+ - Dismissal removes/hides alert per variant.
952
+ - Action path should be clear and minimal.
953
+
954
+ **Often used with**
955
+ - `Button` for direct resolution actions.
956
+
957
+ #### Alert Dialog
958
+
959
+ **Docs-slug:** alert-dialog
960
+
961
+ **Definition**
962
+ Short, focused confirmation or acknowledgment that interrupts the user for a clear binary or limited choice.
963
+
964
+ **Use when**
965
+ - Confirming destructive or irreversible actions.
966
+ - Blocking until the user chooses from a small set of options.
967
+
968
+ **Use something else when**
969
+ - Inline persistence is enough (`Alert`).
970
+ - The flow requires a form or multi-field input (`Dialog`).
971
+ - A quick acknowledgment is sufficient (`Sonner Toast`).
972
+
973
+ **Often used with**
974
+ - `Button` (destructive variant) as the trigger.
975
+
976
+ #### Avatar
977
+
978
+ **Storybook-slug:** avatar
979
+ **Docs-slug:** avatar
980
+
981
+ **Definition**
982
+ Avatar visually represents a user, team, or concept and helps recognition in collaborative UI.
983
+
984
+ **Use when**
985
+ - Showing people in comments, chat, sharing, or collaborators.
986
+ - Representing accounts, teams, or organizations.
987
+ - Displaying AI/agent identities in conversational interfaces.
988
+
989
+ **Behavior**
990
+ - Choose size based on context density.
991
+ - Use overflow patterns for constrained spaces (for example +N with menu).
992
+ - Can be informational or interactive based on context.
993
+ - Can include status badges/dots.
994
+
995
+ **Often used with**
996
+ - `Badge`, `Tooltip`, `Menu`.
997
+
998
+ #### Badge
999
+
1000
+ **Storybook-slug:** badge
1001
+ **Docs-slug:** badge
1002
+
1003
+ **Definition**
1004
+ Compact label for status, category, or metadata.
1005
+
1006
+ **Use when**
1007
+ - Surfacing state at a glance (for example active, draft, error).
1008
+ - Tagging items without taking primary focus from the page.
1009
+
1010
+ **Use something else when**
1011
+ - The message needs explanation or recovery steps (consider `Alert` or inline text).
1012
+ - You need a primary action (use `Button`).
1013
+
1014
+ **Often used with**
1015
+ - `Avatar`, tables and lists, filter chips.
1016
+
1017
+ #### Banner
1018
+
1019
+ **Storybook-slug:** banner
1020
+ **Docs-slug:** banner-alert
1021
+
1022
+ **Definition**
1023
+ Persistent or dismissible message scoped at page or section level — stronger than inline helper text, broader than a single-field `Alert` in some layouts.
1024
+
1025
+ **Use when**
1026
+ - Announcing environment or product state (maintenance, trial, feature preview).
1027
+ - Page-wide outcomes that should stay visible while the user continues.
1028
+
1029
+ **Use something else when**
1030
+ - Task-specific guidance inside a flow (`Alert`).
1031
+ - Brief confirmation after an action (`Sonner Toast`).
1032
+
1033
+ #### Breadcrumb
1034
+
1035
+ **Storybook-slug:** breadcrumb
1036
+ **Docs-slug:** breadcrumbs
1037
+
1038
+ **Definition**
1039
+ Hierarchical navigation aid that shows users their current location within the product's structure. Location-based, not path-based.
1040
+
1041
+ **Use when**
1042
+ - Users need to return to a parent page.
1043
+ - Users need clarity on their current position in the product hierarchy.
1044
+ - Quick access to ancestor pages is useful.
1045
+
1046
+ **Use something else when**
1047
+ - The page structure is flat — there is no hierarchy to show.
1048
+ - Users are switching between same-level content (use `Tabs` or `Segmented Control`).
1049
+
1050
+ **Dos and don'ts**
1051
+ - Do not make the current breadcrumb clickable.
1052
+ - Do not pair with a back button.
1053
+ - Do not wrap breadcrumb labels to multiple lines; truncate and use `Tooltip` for full text.
1054
+ - Show only one breadcrumb trail per page.
1055
+
1056
+ **Behavior**
1057
+ - All links except the current page are interactive (Tab, Shift+Tab, Enter).
1058
+ - When space is limited, condense middle items into an overflow menu showing the first and last two links.
1059
+ - The active page link always remains visible.
1060
+
1061
+ **Often used with**
1062
+ - `Tooltip` for truncated labels, `Menu` for overflow segments, `Topbar`.
1063
+
1064
+ #### Button
1065
+
1066
+ **Storybook-slug:** button
1067
+ **Docs-slug:** button
1068
+
1069
+ **Definition**
1070
+ Primary control for discrete actions.
1071
+
1072
+ **Use when**
1073
+ - Committing, navigating a clear next step, or triggering destructive work (with confirmation pattern).
1074
+
1075
+ **Dos and don'ts**
1076
+ - One primary action per logical section when possible.
1077
+ - Match variant to risk: destructive actions use destructive variant and confirmation.
1078
+ - Label with verb + object (see Content guidelines in `./DESIGN.md`).
1079
+ - Icon-only actions need an accessible name (`aria-label`).
1080
+
1081
+ **Often used with**
1082
+ - `Button Group`, `Dialog`, forms.
1083
+
1084
+ #### Button Group
1085
+
1086
+ **Storybook-slug:** button-group
1087
+
1088
+ **Definition**
1089
+ Visually joins related buttons into a connected row, clarifying that the actions belong to the same context.
1090
+
1091
+ **Use when**
1092
+ - Two or more actions are closely related and operate on the same target (for example, a split-button or segmented action row).
1093
+ - Conserving horizontal space compared to individually spaced buttons.
1094
+
1095
+ **Use something else when**
1096
+ - Actions are unrelated and should not appear grouped.
1097
+ - You need more than a small set of actions (consider `Toolbar` or `Dropdown Menu`).
1098
+
1099
+ **Often used with**
1100
+ - `Button`, `Tooltip` for icon-only variants.
1101
+
1102
+ #### Card
1103
+
1104
+ **Storybook-slug:** card
1105
+ **Docs-slug:** card
1106
+
1107
+ **Definition**
1108
+ A structural container with optional header, body, and footer slots for displaying data artifacts, widgets, or media. The Card with Count variant adds a numeric indicator to the header.
1109
+
1110
+ **Use when**
1111
+ - Presenting charts, visualizations, or data widgets.
1112
+ - Building grids of comparable items where list/grid view toggling is needed.
1113
+ - Displaying media content (images, videos).
1114
+
1115
+ **Use something else when**
1116
+ - You just need visual separation between sections — use `Separator` and spacing instead.
1117
+ - You are comparing dense metadata across rows — use `Table` or a data grid instead.
1118
+
1119
+ **Dos and don'ts**
1120
+ - Cards are structural containers only; interactive elements (`Button`, `Checkbox`) go inside the body or actions area.
1121
+ - Exception: the entire card can serve as a single focusable target when it acts as a link or selection item.
1122
+
1123
+ **Often used with**
1124
+ - `Button`, `Badge`, `Avatar`, `Separator`, charts, lists, or form fields in the body.
1125
+
1126
+ #### Checkbox
1127
+
1128
+ **Storybook-slug:** checkbox
1129
+ **Docs-slug:** checkbox
1130
+
1131
+ **Definition**
1132
+ Enables users to independently select one or multiple options. Can appear standalone or within menus, tree views, tables, or cards.
1133
+
1134
+ **Use when**
1135
+ - Multiple independent selections are required (for example, column visibility in a table).
1136
+ - Enabling or disabling settings where changes do not take immediate effect.
1137
+ - Confirming agreement before an action (for example, delete verification).
1138
+
1139
+ **Use something else when**
1140
+ - Only one option can be selected at a time (use `Radio`).
1141
+ - Options are not displayed simultaneously (use `Select`).
1142
+ - You need an immediate on/off toggle (use `Switch`).
1143
+
1144
+ **Dos and don'ts**
1145
+ - Do provide a label for every checkbox.
1146
+ - Do implement indeterminate states for partial group selection.
1147
+ - Do not pre-select checkboxes automatically.
1148
+ - Do not use a single checkbox unless it is confirming agreement.
1149
+ - Do not use card variants for long option lists.
1150
+
1151
+ **Behavior**
1152
+ - Space key toggles focused checkboxes.
1153
+ - Indeterminate state is set programmatically, not by user interaction.
1154
+ - Parent-child relationships follow selection cascading rules.
1155
+
1156
+ **Often used with**
1157
+ - `Label`, helper text for groups, `Card` variant for options needing descriptions.
1158
+
1159
+ #### Collapsible
1160
+
1161
+ **Storybook-slug:** collapsible
1162
+ **Docs-slug:** collapsible
1163
+
1164
+ **Definition**
1165
+ A single inline expandable block that toggles content visibility. Designed for one independent optional section, not multiple stacked areas.
1166
+
1167
+ **Use when**
1168
+ - Showing one optional or secondary block of content (for example, AI reasoning, advanced settings, a preview).
1169
+ - Content is useful but not essential to the primary task.
1170
+
1171
+ **Use something else when**
1172
+ - You have multiple expandable sections (use `Accordion`).
1173
+ - Content is essential — show it by default.
1174
+ - Users are navigating or filtering (use `Tabs` or filter controls).
1175
+
1176
+ **Dos and don'ts**
1177
+ - Do default to collapsed unless the collapsible content is the main purpose of the view.
1178
+ - Do keep the trigger label descriptive — it should communicate what's inside.
1179
+ - Do not nest collapsibles; use `Accordion` for layered disclosure.
1180
+ - Do not hide errors or required information.
1181
+
1182
+ **Behavior**
1183
+ - One trigger controls one associated region with optional animation.
1184
+ - State changes must be exposed to assistive technology.
1185
+
1186
+ **Often used with**
1187
+ - `Separator` when stacking multiple collapsible regions on a page.
1188
+
1189
+ #### Combobox
1190
+
1191
+ **Storybook-slug:** combobox
1192
+ **Docs-slug:** combobox
1193
+
1194
+ **Definition**
1195
+ A searchable select input that filters options as users type. Supports single and multi-select modes with optional ability to add new items.
1196
+
1197
+ **Use when**
1198
+ - More than approximately 12 options where search efficiency beats scrolling.
1199
+ - Users have a general sense of what they're looking for (country, asset name, tag).
1200
+ - Users need to add new options not in the predefined list.
1201
+
1202
+ **Use something else when**
1203
+ - Fewer than ~12 options: prefer `Select`, `Radio`, or `Checkbox`.
1204
+ - Users are unfamiliar with available options and need a visible list.
1205
+ - Very large datasets risk performance lag: use a data grid with filtering.
1206
+ - Pure text entry without selection (use `Input` or `Textarea`).
1207
+
1208
+ **Dos and don'ts**
1209
+ - Do group related options into categories.
1210
+ - Do position checkmarks right-aligned in menus.
1211
+ - Do not use for simple binary choices or small option sets.
1212
+ - Do not place icons or badges on the left side of menu items.
1213
+
1214
+ **Behavior**
1215
+ - Single-select closes immediately on selection.
1216
+ - Multi-select stays open until the user clicks outside, presses Escape, or Enter.
1217
+
1218
+ **Often used with**
1219
+ - `Label`, helper text, `Badge`.
1220
+
1221
+ #### Command
1222
+
1223
+ **Storybook-slug:** command
1224
+ **Docs-slug:** command
1225
+
1226
+ **Definition**
1227
+ A keyboard-first search interface for discovering and executing actions, navigating pages, or looking up content application-wide. Typically activated via ⌘K / Ctrl+K and displayed inside a `Dialog` or `Popover`.
1228
+
1229
+ **Use when**
1230
+ - Enabling keyboard-driven workflows across an entire application.
1231
+ - Providing power-user shortcuts to actions and destinations.
1232
+ - The application has too many actions or pages to surface in a standard nav.
1233
+
1234
+ **Use something else when**
1235
+ - Filtering a specific list or dataset (use `Search`).
1236
+ - Selecting from known form options (use `Combobox` or `Select`).
1237
+ - Navigating between a small number of pages (use `Tabs` or nav links).
1238
+
1239
+ **Dos and don'ts**
1240
+ - Do organize results into logical categories.
1241
+ - Do use action-oriented labels ("Create asset," "Switch to dark mode").
1242
+ - Do display the keyboard shortcut on triggering elements.
1243
+ - Do surface frequently used items by default.
1244
+ - Do not use for general content search.
1245
+ - Do require confirmation steps for destructive actions.
1246
+
1247
+ **Behavior**
1248
+ - Keyboard-first interface presenting categorized, scannable action lists.
1249
+ - Shows loading indicators for async results and meaningful empty states.
1250
+
1251
+ **Often used with**
1252
+ - `Dialog`, `Popover`, `Search`, `Empty State`.
1253
+
1254
+ #### Count
1255
+
1256
+ **Storybook-slug:** count
1257
+
1258
+ **Definition**
1259
+ A compact numeric indicator used to surface quantities inline — for example, unread messages, selected items, or totals attached to labels or tabs.
1260
+
1261
+ **Use when**
1262
+ - Showing a quantity associated with a label, tab, or list item.
1263
+ - Surfacing unread counts or selection totals without taking primary focus.
1264
+
1265
+ **Use something else when**
1266
+ - The value represents status or category rather than a quantity (use `Badge`).
1267
+
1268
+ **Often used with**
1269
+ - `Tabs`, `Badge`, `Label`, list items.
1270
+
1271
+ #### Date Picker
1272
+
1273
+ **Storybook-slug:** datepicker
1274
+ **Docs-slug:** date-and-time-picker
1275
+
1276
+ **Definition**
1277
+ Allows users to select a single date through a calendar interface, ensuring proper formatting and avoiding input errors.
1278
+
1279
+ **Use when**
1280
+ - Users need to select an exact date.
1281
+ - Preventing manual date-formatting errors is important.
1282
+
1283
+ **Use something else when**
1284
+ - Relative dates are more appropriate ("Last week") — add shortcut options instead.
1285
+ - The date is fixed or recurring (consider a cron expression or plain `Input`).
1286
+ - Exact timing is not critical (use basic `Input`).
1287
+
1288
+ **Behavior**
1289
+ - Opens a calendar anchored to the input field.
1290
+ - Keyboard users can type valid values directly without using the picker.
1291
+ - Values commit in the configured locale format.
1292
+
1293
+ **Often used with**
1294
+ - `Label`, helper text, `Date Range Picker`.
1295
+
1296
+ #### Date Range Picker
1297
+
1298
+ **Storybook-slug:** daterangepicker
1299
+ **Docs-slug:** date-and-time-picker
1300
+
1301
+ **Definition**
1302
+ Allows users to select a start and end date from a calendar interface. Used for filtering by date ranges, comparing periods, or scheduling.
1303
+
1304
+ **Use when**
1305
+ - Users need to specify a date range for filtering or reporting.
1306
+ - Comparing data across a period.
1307
+
1308
+ **Use something else when**
1309
+ - Only a single date is needed (use `Date Picker`).
1310
+ - Relative ranges like "Last 7 days" cover most use cases — add shortcut options.
1311
+
1312
+ **Behavior**
1313
+ - Enforces start/end ordering with validation messages.
1314
+ - Keyboard users can type valid values directly.
1315
+
1316
+ **Often used with**
1317
+ - `Label`, helper text, `Date Picker`.
1318
+
1319
+ #### Date Time Range Picker
1320
+
1321
+ **Storybook-slug:** datetimerangepicker
1322
+ **Docs-slug:** date-and-time-picker
1323
+
1324
+ **Definition**
1325
+ Allows users to select start and end date and time values. Used when precise time boundaries matter, for example scheduling or time-series filtering.
1326
+
1327
+ **Use when**
1328
+ - Users must specify both a date and time for a range (scheduling, time-series queries).
1329
+
1330
+ **Use something else when**
1331
+ - Time precision is not required (use `Date Range Picker`).
1332
+ - Only a single point in time is needed (use `Date Picker` or `Time Picker`).
1333
+
1334
+ **Behavior**
1335
+ - Enforces start/end ordering; validates that end is after start.
1336
+ - Keyboard users can type valid values directly.
1337
+
1338
+ **Often used with**
1339
+ - `Label`, helper text, `Date Range Picker`.
1340
+
1341
+ #### Dialog
1342
+
1343
+ **Storybook-slug:** dialog
1344
+ **Docs-slug:** dialog
1345
+
1346
+ **Definition**
1347
+ Richer content surface: forms, multi-field flows, or explanations that do not fit a strip or inline pattern.
1348
+
1349
+ **Use when**
1350
+ - Collecting input or showing structured content that needs focus without leaving the page.
1351
+
1352
+ **Use something else when**
1353
+ - Inline persistence is enough (`Alert`).
1354
+ - Only a quick acknowledgement is needed (`Sonner Toast`).
1355
+ - The action is binary and destructive (use `Alert Dialog`).
1356
+
1357
+ **Often used with**
1358
+ - `Button`, `Form`, `Alert Dialog` for confirmation steps.
1359
+
1360
+ #### Drawer
1361
+
1362
+ **Storybook-slug:** drawer
1363
+
1364
+ **Definition**
1365
+ Secondary surface that slides in for filters, detail, or medium-length tasks without a full page change.
1366
+
1367
+ **Use when**
1368
+ - Supporting the main view (filters, record details, auxiliary forms).
1369
+
1370
+ **Use something else when**
1371
+ - The task needs full attention or multi-step wizard treatment (full page or `Dialog`).
1372
+ - Content is very short (consider `Popover` or inline).
1373
+
1374
+ #### Dropdown Menu
1375
+
1376
+ **Storybook-slug:** dropdown-menu
1377
+
1378
+ **Definition**
1379
+ A button-triggered overlay listing a set of related actions or options. One of the two menu variants (the other being a context menu, which is right-click triggered). See also: `Menu`.
1380
+
1381
+ **Use when**
1382
+ - A button needs to reveal secondary or overflow actions without persistent UI.
1383
+ - Grouping related actions behind a single trigger to reduce visual clutter.
1384
+
1385
+ **Use something else when**
1386
+ - Options require complex selection or rich descriptions (use `Select Panel`).
1387
+ - Actions need user confirmation (use `Dialog` or `Alert Dialog`).
1388
+ - The action set is always visible and primary (use `Toolbar`).
1389
+
1390
+ **Behavior**
1391
+ - Closes after selection by default.
1392
+ - Positions above, below, or beside the trigger depending on viewport space.
1393
+ - Submenus open on hover.
1394
+
1395
+ **Often used with**
1396
+ - `Button`, `Separator`, `Badge`, checkbox toggles.
1397
+
1398
+ #### Empty State
1399
+
1400
+ **Storybook-slug:** empty
1401
+ **Docs-slug:** empty-state
1402
+
1403
+ **Definition**
1404
+ Placeholder when there is no data yet or results are empty.
1405
+
1406
+ **Use when**
1407
+ - Lists, tables, charts, or artifacts have zero rows/points.
1408
+
1409
+ **Dos and don'ts**
1410
+ - Explain what will appear and how to get started.
1411
+ - Include a single clear CTA when creation/import applies.
1412
+
1413
+ #### Form
1414
+
1415
+ **Storybook-slug:** form
1416
+
1417
+ **Definition**
1418
+ A structural wrapper for form fields that manages layout, spacing, validation state propagation, and submission handling.
1419
+
1420
+ **Use when**
1421
+ - Collecting structured user input across one or more fields.
1422
+ - Grouping related fields with shared validation and submission logic.
1423
+
1424
+ **Dos and don'ts**
1425
+ - Do group semantically related fields together.
1426
+ - Do associate every field with a `Label`.
1427
+ - Do not use `Form` as a generic container when no submission or validation is needed.
1428
+
1429
+ **Often used with**
1430
+ - `Input`, `Select`, `Combobox`, `Checkbox`, `Radio`, `Label`, `Button` (submit), `Dialog`.
1431
+
1432
+ #### Input
1433
+
1434
+ **Storybook-slug:** input
1435
+ **Docs-slug:** input
1436
+
1437
+ **Definition**
1438
+ Single-line text field for capturing short text-based information in forms and toolbars.
1439
+
1440
+ **Use when**
1441
+ - Collecting specific text data (names, credentials, asset identifiers).
1442
+ - A form field requires free text that doesn't fit a structured picker.
1443
+
1444
+ **Use something else when**
1445
+ - Selecting from predefined options (use `Select`, `Combobox`, `Checkbox`, or `Radio`).
1446
+ - Suggestions as the user types are needed (use `Combobox`).
1447
+ - Selecting dates or times (use `Date Picker` / `Time Picker`).
1448
+ - Multi-line text is expected (use `Textarea`).
1449
+
1450
+ **Dos and don'ts**
1451
+ - Do not use long placeholder text that duplicates the label.
1452
+ - Do not mimic pre-filled content with placeholder text.
1453
+ - Do not wrap text in an input; truncate or switch to `Textarea`.
1454
+
1455
+ **Behavior**
1456
+ - Single-line only; updates as the user types.
1457
+ - Validation messages associate with the field for accessibility.
1458
+ - Supports leading (icon, prefix) and trailing (button, suffix, stepper) slots.
1459
+
1460
+ **Often used with**
1461
+ - `Label`, helper text, `Button`, `Tooltip`.
1462
+
1463
+ #### Label
1464
+
1465
+ **Storybook-slug:** label
1466
+ **Docs-slug:** label
1467
+
1468
+ **Definition**
1469
+ A form label that identifies and is programmatically associated with an input field. Not intended as general-purpose text.
1470
+
1471
+ **Use when**
1472
+ - Every `Input`, `Select`, `Combobox`, `Textarea`, `Checkbox` group, `Radio` group, `Switch`, `Slider`, or `Date Picker` needs one.
1473
+
1474
+ **Use something else when**
1475
+ - You need a heading or section title (use appropriate heading levels).
1476
+ - You need descriptive text below a field (use helper text).
1477
+ - You are labeling a non-interactive element like a status indicator (use plain text or `Badge`).
1478
+
1479
+ **Dos and don'ts**
1480
+ - Do associate labels with fields via `htmlFor`/`id` for accessibility.
1481
+ - Do mark required fields consistently (asterisk or explicit text).
1482
+ - Do not replace labels with placeholder text — placeholders disappear and are inaccessible.
1483
+ - Do not hide labels for visual cleanliness; use `Tooltip` to supplement shortened labels.
1484
+
1485
+ **Often used with**
1486
+ - `Input`, `Select`, `Combobox`, `Checkbox`, `Radio`, `Switch`, `Slider`, `Textarea`, `Date Picker`.
1487
+
1488
+ #### Menu
1489
+
1490
+ **Storybook-slug:** menu
1491
+ **Docs-slug:** menu
1492
+
1493
+ **Definition**
1494
+ Presents a list of actions, options, or states for the current selection or context. Two variants: context menu (right-click/long-press trigger) and dropdown menu (button trigger). See also: `Dropdown Menu`.
1495
+
1496
+ **Use when**
1497
+ - Offering action choices from a button, select, or combobox when space is constrained.
1498
+ - Exposing contextual actions via right-click without dedicated trigger UI.
1499
+
1500
+ **Use something else when**
1501
+ - Options require reordering or rich descriptions (use `Select Panel`).
1502
+ - Actions need user confirmation before executing (use `Dialog`, `Alert Dialog`, or `Popover`).
1503
+
1504
+ **Dos and don'ts**
1505
+ - Do keep items left-aligned and styled consistently within sections.
1506
+ - Do separate actions into labeled sections using `Separator`.
1507
+ - Do not mix items with and without leading content (icons/toggles) in the same section.
1508
+
1509
+ **Behavior**
1510
+ - Closes after selection unless multi-select is enabled.
1511
+ - Positions above, below, left, or right of the trigger with a 4px gap, adapting to viewport space.
1512
+ - Submenus open on hover.
1513
+
1514
+ **Often used with**
1515
+ - `Button`, `Select`, `Combobox`, `Separator`, `Badge`, checkbox toggles.
1516
+
1517
+ #### Pagination
1518
+
1519
+ **Storybook-slug:** pagination
1520
+ **Docs-slug:** pagination
1521
+
1522
+ **Definition**
1523
+ Divides large datasets into pages, giving users control over navigation and improving load performance.
1524
+
1525
+ **Use when**
1526
+ - Datasets are large (tables, search results, galleries).
1527
+ - Performance concerns rule out infinite scroll.
1528
+ - Users need to bookmark or return to a specific page position.
1529
+
1530
+ **Use something else when**
1531
+ - The context is a discovery feed (use infinite scroll or "Load more").
1532
+ - Users are completing a sequential task (use a wizard/stepper).
1533
+ - You need to switch between unrelated modes (use `Segmented Control` or `Tabs`).
1534
+
1535
+ **Dos and don'ts**
1536
+ - Do place pagination below content, left-aligned.
1537
+ - Do provide "Next" and "Previous" buttons, disabled when irrelevant.
1538
+ - Do include "Results per page" options for large datasets.
1539
+ - Do not use pagination when fewer than ~20 items per page exist.
1540
+
1541
+ **Behavior**
1542
+ - Each page should have its own shareable URL.
1543
+ - Content loads without full page reloads; use loaders and skeletons while data fetches.
1544
+ - Teleport variant allows direct page number entry.
1545
+ - Filters, searches, and selections persist across pages.
1546
+
1547
+ **Often used with**
1548
+ - `Table`, data grids, `Search`, `Skeleton`.
1549
+
1550
+ #### Popover
1551
+
1552
+ **Storybook-slug:** popover
1553
+ **Docs-slug:** popover
1554
+
1555
+ **Definition**
1556
+ A click-triggered panel for interactive or structured supplemental content. Stays open until dismissed.
1557
+
1558
+ **Use when**
1559
+ - User needs to pick options, fill short fields, or read formatted content on demand without leaving the page.
1560
+
1561
+ **Use something else when**
1562
+ - Content is essential to the task — surface it inline or in `Dialog` / `Drawer`.
1563
+ - A brief, non-interactive hint is needed (use `Tooltip`).
1564
+
1565
+ **Often used with**
1566
+ - `Button` or icon as trigger, `Command`, form controls inside the panel.
1567
+
1568
+ #### Radio
1569
+
1570
+ **Storybook-slug:** radio
1571
+ **Docs-slug:** radio
1572
+
1573
+ **Definition**
1574
+ Allows users to select exactly one option from a small set of mutually exclusive choices.
1575
+
1576
+ **Use when**
1577
+ - Single selection from a small, visible set of predefined options.
1578
+ - All options should be visible side by side for comparison.
1579
+
1580
+ **Use something else when**
1581
+ - Multiple selections are needed (use `Checkbox`).
1582
+ - There are more than ~5 options or space is limited (use `Select` or `Combobox`).
1583
+ - The choice is binary and takes immediate effect (use `Switch`).
1584
+
1585
+ **Dos and don'ts**
1586
+ - Do pair each radio with a descriptive label.
1587
+ - Do not group unrelated options.
1588
+ - Do not exceed 5 options.
1589
+
1590
+ **Behavior**
1591
+ - Clicking or pressing Space selects the focused option and deselects others in the group.
1592
+
1593
+ **Often used with**
1594
+ - `Label`, helper text, `Card` variant for options needing supporting descriptions.
1595
+
1596
+ #### Search
1597
+
1598
+ **Storybook-slug:** search
1599
+ **Docs-slug:** search
1600
+
1601
+ **Definition**
1602
+ A specialized input for locating and filtering content, with built-in search and clear affordances.
1603
+
1604
+ **Use when**
1605
+ - Lists, tables, or datasets need quick item location.
1606
+ - Content-heavy pages where scrolling is impractical.
1607
+ - Application-wide search (in conjunction with `Command`).
1608
+
1609
+ **Use something else when**
1610
+ - Selecting from predefined options (use `Combobox` or `Select`).
1611
+ - Multi-attribute filtering requires dedicated filter controls.
1612
+ - General text input unrelated to content discovery (use `Input`).
1613
+
1614
+ **Dos and don'ts**
1615
+ - Do make it clear whether search covers the current list, the page, or the whole app.
1616
+ - Do display a no-results state when queries return nothing.
1617
+ - Do debounce live search to avoid excessive requests.
1618
+ - Do use descriptive placeholder text ("Search assets").
1619
+ - Do not leave empty results without explanation.
1620
+
1621
+ **Often used with**
1622
+ - `Table`, data grids, `Command`, adjacent filter controls (`Select`, `Combobox`).
1623
+
1624
+ #### Segmented Control
1625
+
1626
+ **Storybook-slug:** segmented
1627
+ **Docs-slug:** segmented-control
1628
+
1629
+ **Definition**
1630
+ Switches between a small number of peer views or modes on the same page.
1631
+
1632
+ **Use when**
1633
+ - Two to several comparable sections (for example overview vs details vs activity).
1634
+
1635
+ **Use something else when**
1636
+ - Content is hierarchical or lengthy and users must open multiple sections at once (consider `Accordion` or visible sections).
1637
+ - Navigating separate routes (tabs/sidebar patterns — see `building-pages.md`).
1638
+
1639
+ **Relationship to Accordion**
1640
+ - Segmented control swaps visibility of peer panels; accordion stacks expandable sections. Prefer segmented control when users switch modes frequently; accordion when progressive disclosure matters.
1641
+
1642
+ #### Select
1643
+
1644
+ **Storybook-slug:** select
1645
+ **Docs-slug:** select
1646
+
1647
+ **Definition**
1648
+ Enables users to choose one or more predefined options from a dropdown list. Used in forms and filtering when space is constrained.
1649
+
1650
+ **Use when**
1651
+ - Multiple predefined options exist and space prevents showing them all at once.
1652
+ - Options are familiar and don't require explanation.
1653
+ - A single or multi-select form input is needed.
1654
+
1655
+ **Use something else when**
1656
+ - 12+ options or search is needed (use `Combobox`).
1657
+ - Few options or a binary choice (use `Checkbox`, `Radio`, or `Switch`).
1658
+ - User-created values are needed (use `Combobox`).
1659
+ - Options need lengthy descriptions (use `Checkbox` or `Radio`).
1660
+ - Selection triggers immediate mode-switch (use `Segmented Control` or `Tabs`).
1661
+
1662
+ **Dos and don'ts**
1663
+ - Do provide a clear label and placeholder.
1664
+ - Do use helper text when clarification is needed.
1665
+ - Exercise caution with default selections — users may overlook them.
1666
+
1667
+ **Behavior**
1668
+ - Single-select closes after selection; multi-select may remain open.
1669
+ - Checkmarks appear right-aligned in the list.
1670
+
1671
+ **Often used with**
1672
+ - `Label`, helper text, `Button`.
1673
+
1674
+ #### Separator
1675
+
1676
+ **Storybook-slug:** separator
1677
+ **Docs-slug:** separator
1678
+
1679
+ **Definition**
1680
+ A 1px visual divider between distinct content sections. Improves readability while remaining visually subtle.
1681
+
1682
+ **Use when**
1683
+ - Creating visual relief between related groups of content.
1684
+ - Dividing sections within toolbars, menus, cards, or forms.
1685
+
1686
+ **Use something else when**
1687
+ - The layout is sparse — whitespace alone is sufficient.
1688
+ - Sections need semantic grouping (use headings, `Card`, or background regions instead).
1689
+
1690
+ **Dos and don'ts**
1691
+ - Do use 16px vertical separators for button or horizontal form element separation.
1692
+ - Do not place separators between every element.
1693
+ - Do not use bold or colorful separators — keep them subtle.
1694
+ - Do not replace semantic headings or landmarks with separators.
1695
+
1696
+ **Often used with**
1697
+ - `Toolbar`, `Card` headers/footers, `Accordion`, menus, dense form sections.
1698
+
1699
+ #### Skeleton
1700
+
1701
+ **Storybook-slug:** skeleton
1702
+
1703
+ **Definition**
1704
+ A loading placeholder that mimics the shape of incoming content, reducing perceived wait time and preventing layout shift.
1705
+
1706
+ **Use when**
1707
+ - Content is loading and the shape of the result is predictable (cards, lists, table rows).
1708
+ - Reducing layout shift while data fetches in the background.
1709
+
1710
+ **Use something else when**
1711
+ - The loading duration is very short (<300ms) — no loader is needed.
1712
+ - The content shape is unpredictable (use a spinner or progress indicator).
1713
+
1714
+ **Dos and don'ts**
1715
+ - Do match skeleton shapes to the actual content layout.
1716
+ - Do not animate excessively — subtle pulse is sufficient.
1717
+
1718
+ **Often used with**
1719
+ - `Card`, `Table`, `Pagination`, lists.
1720
+
1721
+ #### Slider
1722
+
1723
+ **Storybook-slug:** slider
1724
+ **Docs-slug:** slider
1725
+
1726
+ **Definition**
1727
+ An interactive control for selecting a single value or a range from a continuous scale. Provides visual feedback and quick approximate value selection.
1728
+
1729
+ **Use when**
1730
+ - Adjusting continuous values where precision is less important than visual feedback (volume, brightness, pricing filter).
1731
+ - Providing immediate visual feedback (media scrubbing, live previews).
1732
+ - Selecting a minimum and maximum range.
1733
+
1734
+ **Use something else when**
1735
+ - Precise numeric entry is required (use `Input` or `Select`).
1736
+ - The choice is categorical, not continuous (use `Radio` or `Select`).
1737
+
1738
+ **Behavior**
1739
+ - Supports immediate feedback (changes apply as the user drags) and deferred feedback (changes apply on submit).
1740
+ - Use deferred feedback when slider adjustments trigger screen reloads or visual disruptions; pair with helper text explaining that the user must submit to apply.
1741
+
1742
+ **Often used with**
1743
+ - `Label`, helper text, optional adjacent `Input` for precise numeric entry.
1744
+
1745
+ #### Sonner Toast
1746
+
1747
+ **Storybook-slug:** sonner
1748
+ **Docs-slug:** sonner
1749
+
1750
+ **Definition**
1751
+ Lightweight, auto-dismiss feedback for outcomes that do not need a blocking surface.
1752
+
1753
+ **Use when**
1754
+ - Confirming save, delete, or background completion.
1755
+ - Non-critical notices the user can miss without breaking a workflow.
1756
+
1757
+ **Use something else when**
1758
+ - User must read and act before continuing (`Alert Dialog`, `Dialog`, or persistent `Alert` / `Banner`).
1759
+
1760
+ #### Switch
1761
+
1762
+ **Storybook-slug:** switch
1763
+ **Docs-slug:** switch
1764
+
1765
+ **Definition**
1766
+ A binary toggle control that turns a setting on or off, with changes taking effect immediately.
1767
+
1768
+ **Use when**
1769
+ - Toggling a setting that takes immediate effect (for example, dark mode, notifications).
1770
+
1771
+ **Use something else when**
1772
+ - The change is form-dependent and deferred (use `Checkbox` or `Button`).
1773
+ - The action is one-time or destructive (use `Button`).
1774
+ - Multiple related toggles need grouping (use `Toggle Group`, `Checkbox`, or `Select`).
1775
+
1776
+ **Dos and don'ts**
1777
+ - Do apply a clear, descriptive label explaining the switch's function.
1778
+ - Do not embed switches inside `Menu` components — use menu checkmarks instead.
1779
+ - Do not use for destructive actions.
1780
+
1781
+ **Behavior**
1782
+ - Responds instantly to user interaction without requiring separate form submission.
1783
+
1784
+ **Often used with**
1785
+ - `Label`, helper text.
1786
+
1787
+ #### Table
1788
+
1789
+ **Storybook-slug:** table
1790
+
1791
+ **Definition**
1792
+ Dense, scannable display of rows and columns with optional selection and actions.
1793
+
1794
+ **Use when**
1795
+ - Comparing rows, scanning many attributes, or operating on multiple items.
1796
+
1797
+ **Use something else when**
1798
+ - A simple fixed list of links or single-column items (`List`).
1799
+ - A primary chart or narrative view (`Card`, charts — see Storybook).
1800
+
1801
+ **Often used with**
1802
+ - Selection + `Action Toolbar` (when selection-gated actions apply), `Pagination`, `Empty State`, row `Checkbox`, `Dropdown Menu` for row actions.
1803
+
1804
+ #### Tabs
1805
+
1806
+ **Storybook-slug:** tabs
1807
+ **Docs-slug:** tabs
1808
+
1809
+ **Definition**
1810
+ Organizes related content into switchable sections, allowing users to navigate between different views without leaving the page.
1811
+
1812
+ **Use when**
1813
+ - Organizing content into sections users switch between frequently.
1814
+ - Displaying related, mutually exclusive content.
1815
+ - Navigation within pages, dashboards, settings, or data views.
1816
+
1817
+ **Use something else when**
1818
+ - Filtering a list or dataset (use `Segmented Control`, `Button`, or `Menu`).
1819
+ - Multiple sections must be visible simultaneously (use `Accordion` or filters).
1820
+ - The choice is a binary toggle (use `Switch`).
1821
+
1822
+ **Dos and don'ts**
1823
+ - Do use a minimum of two tabs.
1824
+ - Do keep content above tabs stable across all tab states.
1825
+ - Do use leading icons consistently across all tabs or not at all.
1826
+ - Do not use tabs for basic filtering.
1827
+ - Do not apply to binary options.
1828
+
1829
+ **Behavior**
1830
+ - Exactly one tab panel is visible at a time.
1831
+ - Tab buttons manage selection state and keyboard focus.
1832
+ - Supports default, vertical, and full-width alignment options.
1833
+
1834
+ **Often used with**
1835
+ - `Table`, `Form`, `Card`, `Empty State`. Keep global page actions outside tab panels.
1836
+
1837
+ #### Textarea
1838
+
1839
+ **Storybook-slug:** textarea
1840
+ **Docs-slug:** textarea
1841
+
1842
+ **Definition**
1843
+ A multi-line text field for extended free-form input such as comments, feedback, messages, descriptions, or notes.
1844
+
1845
+ **Use when**
1846
+ - Multi-line text is expected (comments, notes, bios, explanations).
1847
+ - Editing large chunks of existing text.
1848
+
1849
+ **Use something else when**
1850
+ - A single line of text is all that is needed (use `Input`).
1851
+ - Structured data is expected (use masked `Input`, `Date Picker`, `Select`, or `Combobox`).
1852
+ - Rich formatting is needed (use a rich-text editor).
1853
+
1854
+ **Dos and don'ts**
1855
+ - Do use concise labels and placeholder text.
1856
+ - Do allow scroll when content exceeds the maximum height.
1857
+ - Do not set a small fixed height for expected lengthy input.
1858
+ - Do not pre-fill with default text users might overlook.
1859
+
1860
+ **Behavior**
1861
+ - Supports optional user resizing via a drag handle.
1862
+ - Restrict resizing when layout integrity is critical (forms in modals or sidebars) or when the textarea auto-expands programmatically.
1863
+
1864
+ **Often used with**
1865
+ - `Label`, helper text (optionally with character count).
1866
+
1867
+ #### Time Picker
1868
+
1869
+ **Storybook-slug:** timepicker
1870
+ **Docs-slug:** date-and-time-picker
1871
+
1872
+ **Definition**
1873
+ Allows users to select a time value through a clock interface.
1874
+
1875
+ **Use when**
1876
+ - Users need to select a precise time without a date.
1877
+ - Scheduling tasks, alarms, or time-of-day settings.
1878
+
1879
+ **Use something else when**
1880
+ - Both date and time are required (use `Date Picker` or `Date Time Range Picker`).
1881
+ - Exact timing is not important (use basic `Input`).
1882
+
1883
+ **Behavior**
1884
+ - Keyboard users can type valid values directly.
1885
+ - Values commit in the configured locale format.
1886
+
1887
+ **Often used with**
1888
+ - `Label`, helper text, `Date Picker`.
1889
+
1890
+ #### Toggle
1891
+
1892
+ **Storybook-slug:** toggle
1893
+
1894
+ **Definition**
1895
+ A single pressable button with active/inactive state, used to toggle one option or formatting command on or off.
1896
+
1897
+ **Use when**
1898
+ - A single binary option needs a visible pressed/unpressed state (for example, bold text, mute).
1899
+
1900
+ **Use something else when**
1901
+ - Two or more related toggles should be grouped (use `Toggle Group`).
1902
+ - The change takes immediate app-level effect (use `Switch`).
1903
+ - The action is a one-time command (use `Button`).
1904
+
1905
+ **Often used with**
1906
+ - `Toolbar`, `Tooltip` for icon-only variants, `Toggle Group`.
1907
+
1908
+ #### Toggle Group
1909
+
1910
+ **Docs-slug:** toggle-group
1911
+
1912
+ **Definition**
1913
+ A set of 2–4 related toggle options for mutually exclusive or multi-select settings that are always visible.
1914
+
1915
+ **Use when**
1916
+ - Toggling between 2–4 always-visible, mutually exclusive modes (for example, grid lines, text alignment, ruler visibility).
1917
+ - The current selection must always be immediately clear.
1918
+
1919
+ **Use something else when**
1920
+ - More than ~4–5 options exist (use `Select` or `Menu`).
1921
+ - Options execute one-time commands (use `Button`).
1922
+ - Multi-select filtering across a larger set (use `Checkbox` or filter chips).
1923
+ - Single-select filtering of a small dataset (use `Segmented Control`).
1924
+ - The context is page navigation (use `Tabs` or routing).
1925
+
1926
+ **Dos and don'ts**
1927
+ - Do keep labels concise — one or two words or icons only.
1928
+ - Do not mix icons and text labels within the same group.
1929
+
1930
+ **Behavior**
1931
+ - Selection updates instantly.
1932
+ - Supports single-select and multi-select configurations.
1933
+
1934
+ **Often used with**
1935
+ - `Toolbar`, `Tooltip` for icon-only variants.
1936
+
1937
+ #### Toolbar
1938
+
1939
+ **Docs-slug:** toolbar
1940
+
1941
+ **Definition**
1942
+ Persistent strip of primary tools or filters for a page or region — available without selecting rows first.
1943
+
1944
+ **Use when**
1945
+ - Page-level create/filter/export actions.
1946
+ - Tools that apply to the whole view or the current query.
1947
+
1948
+ **Use something else when**
1949
+ - Actions apply only after row/item selection (use `Action Toolbar`).
1950
+
1951
+ #### Topbar
1952
+
1953
+ **Storybook-slug:** topbar
1954
+ **Docs-slug:** topbar
1955
+
1956
+ **Definition**
1957
+ The single, persistent navigation bar at the top of every authenticated CDF and Flows custom app. Provides the primary orientation layer across three fixed regions: left (identity/breadcrumbs), middle (optional global navigation), and right (system controls).
1958
+
1959
+ **Use when**
1960
+ - Every authenticated screen in a CDF or Flows app — this component is mandatory.
1961
+ - The app has two or more top-level views requiring global switching.
1962
+ - Actions apply consistently across all app pages (for example, a persistent "Add data" button).
1963
+
1964
+ **Use something else when**
1965
+ - Login or authentication-only screens.
1966
+ - Full-screen flows or modals that intentionally hide global chrome.
1967
+
1968
+ **Dos and don'ts**
1969
+ - Do use the middle section for primary global app navigation.
1970
+ - Do use `Tabs` for distinct pages, `Segmented Control` for mode switching in the middle section.
1971
+ - Do not place page-specific actions in the action slot.
1972
+ - Do not reorder or restyle system controls.
1973
+ - Do not use multiple topbars per page.
1974
+
1975
+ **Behavior**
1976
+ - Left: app mark (small `Avatar`), breadcrumbs, optional inline metadata.
1977
+ - Middle: optional; omit for single-view apps.
1978
+ - Right (fixed order): Share → Notifications → Theme → Atlas.
1979
+
1980
+ **Often used with**
1981
+ - `Breadcrumb`, `Tabs`, `Segmented Control`, `Avatar`.
1982
+
1983
+ #### Tooltip
1984
+
1985
+ **Storybook-slug:** tooltip
1986
+ **Docs-slug:** tooltip
1987
+
1988
+ **Definition**
1989
+ A short hint that appears on hover or focus. No heavy interaction inside.
1990
+
1991
+ **Use when**
1992
+ - Clarifying a control or icon in one line or sentence.
1993
+ - Providing the full text of a truncated label (for example in `Breadcrumb`).
1994
+
1995
+ **Use something else when**
1996
+ - Content is essential to the task — surface it inline or in `Dialog` / `Drawer`.
1997
+ - Users need to interact with the content (use `Popover`).
1998
+
1999
+ **Often used with**
2000
+ - Icon-only `Button`, `Toggle`, `Breadcrumb`, `Label`.
2001
+
2002
+ #### Tree
2003
+
2004
+ **Storybook-slug:** tree
2005
+ **Docs-slug:** tree-view
2006
+
2007
+ **Definition**
2008
+ Displays hierarchical data in a nested structure with expandable/collapsible rows. Supports optional selection and drag-and-drop.
2009
+
2010
+ **Use when**
2011
+ - Presenting large structures with multiple nesting levels (folders, files, organizational hierarchies).
2012
+ - Progressive disclosure of complex hierarchical relationships.
2013
+
2014
+ **Use something else when**
2015
+ - Data is not hierarchical (use lists or `Table`).
2016
+ - A sortable, tabular layout with multiple columns is needed (use `Table`).
2017
+ - Non-hierarchical filtering is the goal (use `Tabs` or `Segmented Control`).
2018
+ - Showing location in site hierarchy (use `Breadcrumb`).
2019
+
2020
+ **Behavior**
2021
+ - Nodes expand and collapse independently.
2022
+ - Keyboard navigation follows tree semantics (arrow keys, Home/End).
2023
+ - Supports single and multi-selection.
2024
+ - Optional drag-and-drop reordering (must maintain accessibility).
2025
+
2026
+ **Often used with**
2027
+ - Row checkboxes, row menus, `Badge` for status, drag handles, selection highlights connecting to a side panel or `Table` in split-view layouts.
2028
+
2029
+ ## Escalation guidance
2030
+
2031
+ If a primitive does not fit:
2032
+ 1. Check Storybook variants/props first.
2033
+ 2. Compose with existing primitives.
2034
+ 3. If still blocked, note the gap and keep implementation consistent with Aura foundations.
2035
+
609
2036
  ---
610
2037
 
611
2038
  ## Do's and Don'ts
@@ -747,6 +2174,20 @@ This section contains Aura's decision rules, component selection guidance, and c
747
2174
 
748
2175
  These rules apply to Aura primitives, host-shell components themed with Aura tokens, and standalone apps using Aura. Component props and enum names live in the component APIs, not in this spec.
749
2176
 
2177
+ ### Aura vs. your responsibility
2178
+
2179
+ Aura components handle many accessibility concerns automatically. Composition, copy, focus management, and page structure remain the implementer's job.
2180
+
2181
+ | Concern | Aura handles | You verify |
2182
+ | --------------------- | --------------------------------------------------- | --------------------------------------------- |
2183
+ | Focus indicators | `shadow-focus-ring` on interactive elements | Not hidden by `overflow` or `z-index` |
2184
+ | Keyboard activation | Button: Enter/Space. Input: standard keys | Custom elements also respond |
2185
+ | ARIA roles | Correct roles on Dialog, SegmentedControl, etc. | Custom components declare correct roles |
2186
+ | Color contrast | Token pairs designed for AA compliance | Page backgrounds don't reduce contrast |
2187
+ | Dark mode | Semantic tokens adapt automatically | Custom colors also work in dark mode |
2188
+ | Disabled states | Communicated via `aria-disabled` | Reason for disabled is accessible |
2189
+ | Focus trapping | Dialog traps focus while open | Focus returns to the trigger element on close |
2190
+
750
2191
  ---
751
2192
 
752
2193
  ### 1. Feedback and system status
@@ -817,8 +2258,35 @@ Prevent errors where possible. When errors happen, users must understand what fa
817
2258
  - **Must** show form errors inline on the affected field and explain how to fix them.
818
2259
  - **Must** protect unsaved work with auto-save where feasible, persistent unsaved state where not, and a discard warning before navigation.
819
2260
  - **Should** offer **Undo** for reversible destructive actions when recovery is cheap and contained in the same session.
2261
+ - **Must** validate fields on blur, not on every keystroke.
2262
+ - **Must** preserve user input on a failed submission — never clear the form.
2263
+ - **Must** move focus to the first invalid field after a failed submission and announce the error via `aria-live`.
820
2264
  - **Avoid** using toast as the only safety net for irreversible work or revealing every validation error only on final submit.
821
2265
 
2266
+ **Field validation states**
2267
+
2268
+ Not every field type needs every validation kind. Use this to scope what to implement:
2269
+
2270
+ | Field type | Required | Format | Length | Range | Uniqueness |
2271
+ | ------------- | -------- | ------ | -------- | ------------ | ---------- |
2272
+ | Text input | Yes | — | Optional | — | Optional |
2273
+ | Email input | Yes | Yes | — | — | Optional |
2274
+ | Password | Yes | Yes | Yes | — | — |
2275
+ | Number input | Yes | — | — | Yes | — |
2276
+ | Date picker | Yes | — | — | Yes | — |
2277
+ | Textarea | Yes | — | Yes | — | — |
2278
+ | Select | Yes | — | — | — | — |
2279
+ | Combobox | Yes | — | — | — | — |
2280
+ | Checkbox | — | — | — | — | — |
2281
+ | File upload | Yes | Yes | — | Yes (size) | — |
2282
+
2283
+ **Edge cases**
2284
+
2285
+ - Destructive action with undo? Still confirm — mention the undo window in the dialog body ("You can undo within 30 seconds").
2286
+ - Bulk delete? One confirmation naming the count ("Delete 12 reports?"), not one per item.
2287
+ - Auto-save? Use a subtle persistent "Saved" indicator, not a toast on every save.
2288
+ - Error partway through a multi-step flow? Don't lose progress — show the error on the current step and let the user retry from there.
2289
+
822
2290
  ---
823
2291
 
824
2292
  ### 5. Enabling power users
@@ -857,8 +2325,29 @@ Aura targets **WCAG AA** for primitives — usage must preserve that.
857
2325
  - **Must** name icon-only controls and pair them with a **Tooltip**.
858
2326
  - **Must not** encode meaning with color alone. Pair color with text, icon, helper text, or label.
859
2327
  - **Must** meet contrast and target-size requirements for the shipped context.
2328
+ - **Must** follow visual/reading order for tab order, with no keyboard traps; add a skip-to-content link on pages with complex navigation.
2329
+ - **Must** use heading levels in strict sequential order: one `H1` per page, never skip a level, and never use a heading tag purely for visual sizing — use the Typography scale instead.
860
2330
  - **Avoid** pointer-only behavior, unreadable `muted-foreground` copy for required tasks, and sub-24px icon hit zones without expansion.
861
2331
 
2332
+ **Alt text and icon naming**
2333
+
2334
+ | Type | Approach | Example |
2335
+ | ------------------------ | ---------------------------- | ------------------------------------- |
2336
+ | Informational image | Describe the content | `alt="Chart: output up 20%"` |
2337
+ | Decorative image | Empty | `alt=""` |
2338
+ | Icon-only control | `aria-label` on the control | `aria-label="Delete report"` |
2339
+ | Icon paired with a label | Hide the icon | `aria-hidden="true"` on the icon |
2340
+
2341
+ **Announcing dynamic content**
2342
+
2343
+ | Scenario | Method |
2344
+ | ---------------------- | --------------------------------------------- |
2345
+ | Search/list results update | `aria-live="polite"` |
2346
+ | Form error | `aria-live="assertive"` |
2347
+ | Toast | Handled by the toast component |
2348
+ | Dialog opens | Focus moves into the dialog (Aura handles) |
2349
+ | Dialog closes | Return focus to the trigger element |
2350
+
862
2351
  ### Common pitfalls (agent guidance)
863
2352
 
864
2353
  These are the most frequent mistakes when generating or modifying Aura-based UI. Avoid all of them.
@@ -871,6 +2360,31 @@ These are the most frequent mistakes when generating or modifying Aura-based UI.
871
2360
  - Icon-only controls without accessible names and tooltips.
872
2361
  - Disabled primary CTAs with no visible path to resolve the blocker.
873
2362
 
2363
+ ### Verifying accessibility
2364
+
2365
+ **Self-check before shipping a page**
2366
+
2367
+ - [ ] Tab through all elements in logical order
2368
+ - [ ] Every button/link works with Enter/Space
2369
+ - [ ] Every dialog opens/closes with keyboard, and Escape closes dialogs, popovers, and dropdowns
2370
+ - [ ] Every image has appropriate alt text; every form field has a visible label
2371
+ - [ ] Non-color indicator present for every status
2372
+ - [ ] Headings follow H1 → H2 → H3 with no skipped levels
2373
+ - [ ] Dynamic updates are announced to screen readers
2374
+ - [ ] Focus ring (`shadow-focus-ring`) is visible on all interactive elements
2375
+
2376
+ **Tooling**
2377
+
2378
+ - Automated: WAVE, axe DevTools, or Lighthouse in Chrome DevTools.
2379
+ - Manual: unplug the mouse and complete primary tasks keyboard-only; spot-check critical flows with VoiceOver (Mac) or NVDA (Windows).
2380
+
2381
+ **Accessibility edge cases**
2382
+
2383
+ - Complex data visualization? Provide a text summary via `alt` or screen-reader-only text.
2384
+ - Drag-and-drop? Requires a keyboard alternative.
2385
+ - Real-time dashboard? Use `aria-live="polite"`, not `"assertive"` — frequent updates should not interrupt the user.
2386
+ - Third-party embed? Give the `iframe` a descriptive `title`.
2387
+
874
2388
  ---
875
2389
 
876
2390
  ## Interaction states
@@ -1196,6 +2710,7 @@ Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
1196
2710
  - Avoid idioms and cultural references
1197
2711
  - No ampersands: use "and"
1198
2712
  - Small words (a, the, that, is): include in prose; may omit only in space-constrained labels and CTAs
2713
+ - Short sentences and simple grammar translate more reliably; plan for text expansion in localized UI (e.g. German often adds 30–40% length) with flexible button and title widths, not fixed ones
1199
2714
 
1200
2715
  ### Benchmarks
1201
2716