@commercetools/nimbus-mcp 0.1.0 → 2.10.0
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.
- package/README.md +63 -14
- package/data/docs/route-manifest.json +10913 -0
- package/data/docs/routes/components-accessibility-visually-hidden.json +388 -0
- package/data/docs/routes/components-accessibility.json +34 -0
- package/data/docs/routes/components-buttons-button.json +715 -0
- package/data/docs/routes/components-buttons-icon-button.json +852 -0
- package/data/docs/routes/components-buttons-icon-toggle-button.json +594 -0
- package/data/docs/routes/components-buttons-split-button.json +670 -0
- package/data/docs/routes/components-buttons-toggle-button-group.json +722 -0
- package/data/docs/routes/components-buttons-toggle-button.json +689 -0
- package/data/docs/routes/components-buttons.json +36 -0
- package/data/docs/routes/components-data-display-badge.json +555 -0
- package/data/docs/routes/components-data-display-card.json +338 -0
- package/data/docs/routes/components-data-display-data-table.json +855 -0
- package/data/docs/routes/components-data-display-draggable-list.json +596 -0
- package/data/docs/routes/components-data-display-table.json +472 -0
- package/data/docs/routes/components-data-display-tag-group.json +535 -0
- package/data/docs/routes/components-data-display.json +34 -0
- package/data/docs/routes/components-feedback-alert.json +696 -0
- package/data/docs/routes/components-feedback-dialog.json +682 -0
- package/data/docs/routes/components-feedback-drawer.json +600 -0
- package/data/docs/routes/components-feedback-loading-spinner.json +415 -0
- package/data/docs/routes/components-feedback-progress-bar.json +661 -0
- package/data/docs/routes/components-feedback-toast.json +1040 -0
- package/data/docs/routes/components-feedback-tooltip.json +510 -0
- package/data/docs/routes/components-feedback.json +34 -0
- package/data/docs/routes/components-forms-field-errors.json +557 -0
- package/data/docs/routes/components-forms-form-field.json +848 -0
- package/data/docs/routes/components-forms-group.json +427 -0
- package/data/docs/routes/components-forms-localized-field.json +770 -0
- package/data/docs/routes/components-forms.json +37 -0
- package/data/docs/routes/components-inputs-calendar.json +611 -0
- package/data/docs/routes/components-inputs-checkbox.json +774 -0
- package/data/docs/routes/components-inputs-combo-box.json +761 -0
- package/data/docs/routes/components-inputs-date-input.json +628 -0
- package/data/docs/routes/components-inputs-date-picker.json +709 -0
- package/data/docs/routes/components-inputs-date-range-picker.json +599 -0
- package/data/docs/routes/components-inputs-money-input.json +721 -0
- package/data/docs/routes/components-inputs-multiline-text-input.json +611 -0
- package/data/docs/routes/components-inputs-number-input.json +647 -0
- package/data/docs/routes/components-inputs-password-input.json +576 -0
- package/data/docs/routes/components-inputs-radio-input.json +583 -0
- package/data/docs/routes/components-inputs-range-calendar.json +607 -0
- package/data/docs/routes/components-inputs-rich-text-input.json +599 -0
- package/data/docs/routes/components-inputs-scoped-search-input.json +570 -0
- package/data/docs/routes/components-inputs-search-input.json +588 -0
- package/data/docs/routes/components-inputs-select-input.json +960 -0
- package/data/docs/routes/components-inputs-switch.json +720 -0
- package/data/docs/routes/components-inputs-text-input.json +566 -0
- package/data/docs/routes/components-inputs-time-input.json +775 -0
- package/data/docs/routes/components-inputs.json +34 -0
- package/data/docs/routes/components-layout-box.json +501 -0
- package/data/docs/routes/components-layout-defaultpage.json +748 -0
- package/data/docs/routes/components-layout-flex.json +587 -0
- package/data/docs/routes/components-layout-grid.json +393 -0
- package/data/docs/routes/components-layout-modalpage.json +716 -0
- package/data/docs/routes/components-layout-pagecontent.json +673 -0
- package/data/docs/routes/components-layout-separator.json +461 -0
- package/data/docs/routes/components-layout-simple-grid.json +519 -0
- package/data/docs/routes/components-layout-spacer.json +573 -0
- package/data/docs/routes/components-layout-stack.json +481 -0
- package/data/docs/routes/components-layout.json +34 -0
- package/data/docs/routes/components-media-avatar.json +427 -0
- package/data/docs/routes/components-media-icon.json +663 -0
- package/data/docs/routes/components-media-image.json +511 -0
- package/data/docs/routes/components-media-inline-svg.json +586 -0
- package/data/docs/routes/components-media.json +34 -0
- package/data/docs/routes/components-navigation-accordion.json +643 -0
- package/data/docs/routes/components-navigation-collapsible-motion.json +628 -0
- package/data/docs/routes/components-navigation-link.json +554 -0
- package/data/docs/routes/components-navigation-menu.json +546 -0
- package/data/docs/routes/components-navigation-pagination.json +502 -0
- package/data/docs/routes/components-navigation-steps.json +629 -0
- package/data/docs/routes/components-navigation-tabnav.json +546 -0
- package/data/docs/routes/components-navigation-tabs.json +635 -0
- package/data/docs/routes/components-navigation-toolbar.json +549 -0
- package/data/docs/routes/components-navigation.json +34 -0
- package/data/docs/routes/components-typography-code.json +39 -0
- package/data/docs/routes/components-typography-heading.json +402 -0
- package/data/docs/routes/components-typography-kbd.json +399 -0
- package/data/docs/routes/components-typography-list.json +593 -0
- package/data/docs/routes/components-typography-text.json +444 -0
- package/data/docs/routes/components-typography.json +34 -0
- package/data/docs/routes/components-utilities-nimbus-i18n-provider.json +295 -0
- package/data/docs/routes/components-utilities-nimbus-provider.json +663 -0
- package/data/docs/routes/components-utilities.json +34 -0
- package/data/docs/routes/components.json +33 -0
- package/data/docs/routes/home-contribute-adrs-adr0001-consumer-component-apis.json +314 -0
- package/data/docs/routes/home-contribute-adrs-adr0002-compound-component-extraction.json +160 -0
- package/data/docs/routes/home-contribute-adrs-adr0003-component-lifecycle-states.json +460 -0
- package/data/docs/routes/home-contribute-adrs.json +205 -0
- package/data/docs/routes/home-contribute-development-setup.json +213 -0
- package/data/docs/routes/home-contribute-stats.json +36 -0
- package/data/docs/routes/home-contribute.json +36 -0
- package/data/docs/routes/home-design-tokens-aspect-ratios.json +36 -0
- package/data/docs/routes/home-design-tokens-borders.json +35 -0
- package/data/docs/routes/home-design-tokens-colors.json +157 -0
- package/data/docs/routes/home-design-tokens-other-animations.json +119 -0
- package/data/docs/routes/home-design-tokens-other-blurs.json +36 -0
- package/data/docs/routes/home-design-tokens-other-breakpoints.json +61 -0
- package/data/docs/routes/home-design-tokens-other-cursors.json +36 -0
- package/data/docs/routes/home-design-tokens-other-z-indices.json +39 -0
- package/data/docs/routes/home-design-tokens-other.json +35 -0
- package/data/docs/routes/home-design-tokens-radii.json +59 -0
- package/data/docs/routes/home-design-tokens-shadows.json +57 -0
- package/data/docs/routes/home-design-tokens-sizes.json +137 -0
- package/data/docs/routes/home-design-tokens-spacing.json +36 -0
- package/data/docs/routes/home-design-tokens-typography.json +184 -0
- package/data/docs/routes/home-design-tokens.json +34 -0
- package/data/docs/routes/home-getting-started-core-concepts.json +301 -0
- package/data/docs/routes/home-getting-started-installation.json +621 -0
- package/data/docs/routes/home-getting-started-mcp-server-overview.json +139 -0
- package/data/docs/routes/home-getting-started-mcp-server-setup.json +316 -0
- package/data/docs/routes/home-getting-started-release-process.json +294 -0
- package/data/docs/routes/home-getting-started-testing-setup.json +296 -0
- package/data/docs/routes/home-playground-markdown.json +638 -0
- package/data/docs/routes/home-playground-toc.json +169 -0
- package/data/docs/routes/home-playground.json +34 -0
- package/data/docs/routes/home-style-props-background.json +236 -0
- package/data/docs/routes/home-style-props-border.json +310 -0
- package/data/docs/routes/home-style-props-display.json +120 -0
- package/data/docs/routes/home-style-props-effects.json +116 -0
- package/data/docs/routes/home-style-props-filters.json +396 -0
- package/data/docs/routes/home-style-props-flex-and-grid.json +496 -0
- package/data/docs/routes/home-style-props-interactivity.json +356 -0
- package/data/docs/routes/home-style-props-layout.json +422 -0
- package/data/docs/routes/home-style-props-list.json +116 -0
- package/data/docs/routes/home-style-props-sizing.json +244 -0
- package/data/docs/routes/home-style-props-spacing.json +228 -0
- package/data/docs/routes/home-style-props-svg.json +96 -0
- package/data/docs/routes/home-style-props-tables.json +116 -0
- package/data/docs/routes/home-style-props-transforms.json +216 -0
- package/data/docs/routes/home-style-props-transitions.json +216 -0
- package/data/docs/routes/home-style-props-typography.json +536 -0
- package/data/docs/routes/home-style-props.json +33 -0
- package/data/docs/routes/home.json +32 -0
- package/data/docs/routes/hooks-usecopytoclipboard.json +76 -0
- package/data/docs/routes/hooks-usehotkeys.json +117 -0
- package/data/docs/routes/hooks.json +33 -0
- package/data/docs/routes/icons.json +32 -0
- package/data/docs/routes/patterns-fields-date-range-picker-field.json +393 -0
- package/data/docs/routes/patterns-fields-money-input-field.json +415 -0
- package/data/docs/routes/patterns-fields-multiline-text-input-field.json +404 -0
- package/data/docs/routes/patterns-fields-number-input-field.json +470 -0
- package/data/docs/routes/patterns-fields-password-input-field.json +319 -0
- package/data/docs/routes/patterns-fields-search-input-field.json +382 -0
- package/data/docs/routes/patterns-fields-text-input-field.json +404 -0
- package/data/docs/routes/patterns-fields.json +78 -0
- package/data/docs/routes/patterns.json +34 -0
- package/data/docs/search-index.json +1 -0
- package/data/docs/types/Accordion.json +12 -0
- package/data/docs/types/AccordionContent.json +286 -0
- package/data/docs/types/AccordionHeader.json +891 -0
- package/data/docs/types/AccordionHeaderRightContent.json +27 -0
- package/data/docs/types/AccordionItem.json +242 -0
- package/data/docs/types/AccordionRoot.json +162 -0
- package/data/docs/types/Alert.json +12 -0
- package/data/docs/types/AlertActions.json +11 -0
- package/data/docs/types/AlertDescription.json +118 -0
- package/data/docs/types/AlertDismissButton.json +937 -0
- package/data/docs/types/AlertRoot.json +42 -0
- package/data/docs/types/AlertTitle.json +118 -0
- package/data/docs/types/Avatar.json +125 -0
- package/data/docs/types/Badge.json +64 -0
- package/data/docs/types/Body.json +67 -0
- package/data/docs/types/Box.json +85 -0
- package/data/docs/types/Button.json +1015 -0
- package/data/docs/types/Calendar.json +565 -0
- package/data/docs/types/Caption.json +67 -0
- package/data/docs/types/Card.json +12 -0
- package/data/docs/types/CardContent.json +27 -0
- package/data/docs/types/CardHeader.json +27 -0
- package/data/docs/types/CardRoot.json +106 -0
- package/data/docs/types/Cell.json +227 -0
- package/data/docs/types/Checkbox.json +897 -0
- package/data/docs/types/Code.json +112 -0
- package/data/docs/types/CollapsibleMotionContent.json +35 -0
- package/data/docs/types/CollapsibleMotionRoot.json +99 -0
- package/data/docs/types/CollapsibleMotionTrigger.json +71 -0
- package/data/docs/types/Column.json +101 -0
- package/data/docs/types/ColumnGroup.json +101 -0
- package/data/docs/types/ColumnHeader.json +193 -0
- package/data/docs/types/ComboBoxListBox.json +751 -0
- package/data/docs/types/ComboBoxOption.json +672 -0
- package/data/docs/types/ComboBoxPopover.json +786 -0
- package/data/docs/types/ComboBoxRoot.json +747 -0
- package/data/docs/types/ComboBoxSection.json +277 -0
- package/data/docs/types/ComboBoxTrigger.json +70 -0
- package/data/docs/types/Content.json +33 -0
- package/data/docs/types/DataTable.json +596 -0
- package/data/docs/types/DataTableBody.json +223 -0
- package/data/docs/types/DataTableFooter.json +27 -0
- package/data/docs/types/DataTableHeader.json +269 -0
- package/data/docs/types/DataTableManager.json +11 -0
- package/data/docs/types/DataTableRoot.json +590 -0
- package/data/docs/types/DataTableTable.json +271 -0
- package/data/docs/types/DateInput.json +792 -0
- package/data/docs/types/DatePicker.json +700 -0
- package/data/docs/types/DateRangePicker.json +936 -0
- package/data/docs/types/DateRangePickerField.json +1047 -0
- package/data/docs/types/DefaultPage.json +12 -0
- package/data/docs/types/DefaultPageActions.json +27 -0
- package/data/docs/types/DefaultPageBackLink.json +213 -0
- package/data/docs/types/DefaultPageContent.json +27 -0
- package/data/docs/types/DefaultPageFooter.json +27 -0
- package/data/docs/types/DefaultPageHeader.json +27 -0
- package/data/docs/types/DefaultPageRoot.json +106 -0
- package/data/docs/types/DefaultPageSubtitle.json +27 -0
- package/data/docs/types/DefaultPageTabNav.json +28 -0
- package/data/docs/types/DefaultPageTitle.json +27 -0
- package/data/docs/types/DialogBody.json +27 -0
- package/data/docs/types/DialogCloseTrigger.json +939 -0
- package/data/docs/types/DialogContent.json +27 -0
- package/data/docs/types/DialogFooter.json +27 -0
- package/data/docs/types/DialogHeader.json +27 -0
- package/data/docs/types/DialogRoot.json +138 -0
- package/data/docs/types/DialogTitle.json +27 -0
- package/data/docs/types/DialogTrigger.json +80 -0
- package/data/docs/types/DraggableList.json +12 -0
- package/data/docs/types/DraggableListField.json +894 -0
- package/data/docs/types/DraggableListItem.json +574 -0
- package/data/docs/types/DraggableListRoot.json +745 -0
- package/data/docs/types/Drawer.json +12 -0
- package/data/docs/types/DrawerBody.json +27 -0
- package/data/docs/types/DrawerCloseTrigger.json +939 -0
- package/data/docs/types/DrawerContent.json +27 -0
- package/data/docs/types/DrawerFooter.json +27 -0
- package/data/docs/types/DrawerHeader.json +27 -0
- package/data/docs/types/DrawerRoot.json +142 -0
- package/data/docs/types/DrawerTitle.json +27 -0
- package/data/docs/types/DrawerTrigger.json +80 -0
- package/data/docs/types/FieldErrors.getBuiltInMessage.json +11 -0
- package/data/docs/types/FieldErrors.getCustomMessage.json +9 -0
- package/data/docs/types/FieldErrors.json +109 -0
- package/data/docs/types/Flex.json +238 -0
- package/data/docs/types/Footer.json +67 -0
- package/data/docs/types/FormFieldDescription.json +11 -0
- package/data/docs/types/FormFieldError.json +11 -0
- package/data/docs/types/FormFieldInfoBox.json +27 -0
- package/data/docs/types/FormFieldInput.json +11 -0
- package/data/docs/types/FormFieldLabel.json +11 -0
- package/data/docs/types/FormFieldRoot.json +148 -0
- package/data/docs/types/Grid.json +253 -0
- package/data/docs/types/GridProps.json +11 -0
- package/data/docs/types/Group.json +143 -0
- package/data/docs/types/Header.json +67 -0
- package/data/docs/types/Heading.json +109 -0
- package/data/docs/types/Icon.json +112 -0
- package/data/docs/types/IconButton.json +1019 -0
- package/data/docs/types/IconToggleButton.json +787 -0
- package/data/docs/types/Image.json +373 -0
- package/data/docs/types/Indicator.json +67 -0
- package/data/docs/types/InlineSvg.json +98 -0
- package/data/docs/types/Item.json +67 -0
- package/data/docs/types/Kbd.json +118 -0
- package/data/docs/types/Link.json +380 -0
- package/data/docs/types/List.json +12 -0
- package/data/docs/types/ListIndicator.json +70 -0
- package/data/docs/types/ListItem.json +70 -0
- package/data/docs/types/ListRoot.json +124 -0
- package/data/docs/types/LoadingSpinner.json +87 -0
- package/data/docs/types/LocalizedField.json +460 -0
- package/data/docs/types/LocalizedStringFormatter.json +9 -0
- package/data/docs/types/MakeElementFocusable.json +196 -0
- package/data/docs/types/MenuContent.json +111 -0
- package/data/docs/types/MenuItem.json +671 -0
- package/data/docs/types/MenuRoot.json +670 -0
- package/data/docs/types/MenuSection.json +364 -0
- package/data/docs/types/MenuSubmenu.json +111 -0
- package/data/docs/types/MenuSubmenuTrigger.json +67 -0
- package/data/docs/types/MenuTrigger.json +906 -0
- package/data/docs/types/ModalPage.json +12 -0
- package/data/docs/types/ModalPageActions.json +27 -0
- package/data/docs/types/ModalPageContent.json +27 -0
- package/data/docs/types/ModalPageFooter.json +27 -0
- package/data/docs/types/ModalPageHeader.json +27 -0
- package/data/docs/types/ModalPageRoot.json +87 -0
- package/data/docs/types/ModalPageSubtitle.json +27 -0
- package/data/docs/types/ModalPageTabNav.json +28 -0
- package/data/docs/types/ModalPageTitle.json +27 -0
- package/data/docs/types/ModalPageTopBar.json +57 -0
- package/data/docs/types/MoneyInput.isEmpty.json +40 -0
- package/data/docs/types/MoneyInput.json +282 -0
- package/data/docs/types/MoneyInputField.json +379 -0
- package/data/docs/types/MoneyInputFieldProps.json +9 -0
- package/data/docs/types/MultilineTextInput.json +1194 -0
- package/data/docs/types/MultilineTextInputField.json +1269 -0
- package/data/docs/types/MultilineTextInputFieldProps.json +9 -0
- package/data/docs/types/NimbusI18nProvider.json +42 -0
- package/data/docs/types/NimbusI18nProviderProps.json +9 -0
- package/data/docs/types/NimbusProvider.json +270 -0
- package/data/docs/types/NumberInput.json +952 -0
- package/data/docs/types/NumberInputField.json +1004 -0
- package/data/docs/types/NumberInputFieldProps.json +9 -0
- package/data/docs/types/PageContent.json +11 -0
- package/data/docs/types/PageContentColumn.json +99 -0
- package/data/docs/types/PageContentRoot.json +114 -0
- package/data/docs/types/Pagination.json +159 -0
- package/data/docs/types/PasswordInput.json +1120 -0
- package/data/docs/types/PasswordInputField.json +1216 -0
- package/data/docs/types/PasswordInputFieldProps.json +9 -0
- package/data/docs/types/ProgressBar.json +280 -0
- package/data/docs/types/RadioInputOption.json +550 -0
- package/data/docs/types/RadioInputRoot.json +514 -0
- package/data/docs/types/RangeCalendar.json +618 -0
- package/data/docs/types/RichTextInput.json +134 -0
- package/data/docs/types/Root.json +122 -0
- package/data/docs/types/Row.json +67 -0
- package/data/docs/types/ScopedSearchInput.isEmpty.json +40 -0
- package/data/docs/types/ScopedSearchInput.json +253 -0
- package/data/docs/types/ScrollArea.json +82 -0
- package/data/docs/types/SearchInput.json +1165 -0
- package/data/docs/types/SearchInputField.json +1240 -0
- package/data/docs/types/Select.json +12 -0
- package/data/docs/types/SelectOption.json +572 -0
- package/data/docs/types/SelectOptionGroup.json +215 -0
- package/data/docs/types/SelectOptions.json +693 -0
- package/data/docs/types/SelectRoot.json +926 -0
- package/data/docs/types/Separator.json +65 -0
- package/data/docs/types/SimpleGrid.json +291 -0
- package/data/docs/types/Spacer.json +27 -0
- package/data/docs/types/SpacerProps.json +9 -0
- package/data/docs/types/SplitButton.json +203 -0
- package/data/docs/types/Stack.json +144 -0
- package/data/docs/types/Steps.json +12 -0
- package/data/docs/types/StepsChangeDetails.json +9 -0
- package/data/docs/types/StepsCompletedContent.json +28 -0
- package/data/docs/types/StepsCompletedContentProps.json +9 -0
- package/data/docs/types/StepsContent.json +43 -0
- package/data/docs/types/StepsContentProps.json +9 -0
- package/data/docs/types/StepsDescription.json +28 -0
- package/data/docs/types/StepsDescriptionProps.json +9 -0
- package/data/docs/types/StepsIndicator.json +28 -0
- package/data/docs/types/StepsIndicatorProps.json +9 -0
- package/data/docs/types/StepsItem.json +43 -0
- package/data/docs/types/StepsItemProps.json +9 -0
- package/data/docs/types/StepsList.json +28 -0
- package/data/docs/types/StepsListProps.json +9 -0
- package/data/docs/types/StepsNextTrigger.json +62 -0
- package/data/docs/types/StepsNextTriggerProps.json +9 -0
- package/data/docs/types/StepsNumber.json +28 -0
- package/data/docs/types/StepsNumberProps.json +9 -0
- package/data/docs/types/StepsPrevTrigger.json +62 -0
- package/data/docs/types/StepsPrevTriggerProps.json +9 -0
- package/data/docs/types/StepsRoot.json +183 -0
- package/data/docs/types/StepsRootProps.json +11 -0
- package/data/docs/types/StepsSeparator.json +28 -0
- package/data/docs/types/StepsSeparatorProps.json +9 -0
- package/data/docs/types/StepsStatus.json +57 -0
- package/data/docs/types/StepsStatusProps.json +9 -0
- package/data/docs/types/StepsTitle.json +28 -0
- package/data/docs/types/StepsTitleProps.json +9 -0
- package/data/docs/types/StepsTrigger.json +47 -0
- package/data/docs/types/StepsTriggerProps.json +9 -0
- package/data/docs/types/Switch.json +371 -0
- package/data/docs/types/TabListProps.json +9 -0
- package/data/docs/types/TabNav.json +12 -0
- package/data/docs/types/TabNavItem.json +300 -0
- package/data/docs/types/TabNavItemProps.json +9 -0
- package/data/docs/types/TabNavProps.json +9 -0
- package/data/docs/types/TabNavRoot.json +80 -0
- package/data/docs/types/TabPanelProps.json +9 -0
- package/data/docs/types/TabPanelsProps.json +9 -0
- package/data/docs/types/TabProps.json +9 -0
- package/data/docs/types/Table.json +9 -0
- package/data/docs/types/TableBody.json +67 -0
- package/data/docs/types/TableBodyProps.json +9 -0
- package/data/docs/types/TableCaption.json +67 -0
- package/data/docs/types/TableCaptionProps.json +9 -0
- package/data/docs/types/TableCell.json +227 -0
- package/data/docs/types/TableCellProps.json +9 -0
- package/data/docs/types/TableColumn.json +101 -0
- package/data/docs/types/TableColumnGroup.json +101 -0
- package/data/docs/types/TableColumnGroupProps.json +9 -0
- package/data/docs/types/TableColumnHeader.json +193 -0
- package/data/docs/types/TableColumnHeaderProps.json +9 -0
- package/data/docs/types/TableColumnProps.json +9 -0
- package/data/docs/types/TableFooter.json +67 -0
- package/data/docs/types/TableFooterProps.json +9 -0
- package/data/docs/types/TableHeader.json +67 -0
- package/data/docs/types/TableHeaderProps.json +9 -0
- package/data/docs/types/TableRoot.json +365 -0
- package/data/docs/types/TableRootProps.json +12 -0
- package/data/docs/types/TableRow.json +67 -0
- package/data/docs/types/TableRowProps.json +9 -0
- package/data/docs/types/TableScrollArea.json +82 -0
- package/data/docs/types/TableScrollAreaProps.json +9 -0
- package/data/docs/types/Tabs.json +12 -0
- package/data/docs/types/TabsList.json +110 -0
- package/data/docs/types/TabsPanel.json +112 -0
- package/data/docs/types/TabsPanels.json +108 -0
- package/data/docs/types/TabsRoot.json +211 -0
- package/data/docs/types/TabsTab.json +174 -0
- package/data/docs/types/TagGroup.json +12 -0
- package/data/docs/types/TagGroupRoot.json +306 -0
- package/data/docs/types/TagGroupTag.json +595 -0
- package/data/docs/types/TagGroupTagList.json +166 -0
- package/data/docs/types/Text.json +119 -0
- package/data/docs/types/TextInput.json +1156 -0
- package/data/docs/types/TextInputField.json +1263 -0
- package/data/docs/types/TimeInput.json +752 -0
- package/data/docs/types/ToastAction.json +9 -0
- package/data/docs/types/ToastManagerApi.json +9 -0
- package/data/docs/types/ToastOptions.json +9 -0
- package/data/docs/types/ToastOutlet.json +12 -0
- package/data/docs/types/ToastPlacement.json +9 -0
- package/data/docs/types/ToastPromiseOptions.json +9 -0
- package/data/docs/types/ToastType.json +9 -0
- package/data/docs/types/ToastVariant.json +9 -0
- package/data/docs/types/ToggleButton.json +789 -0
- package/data/docs/types/ToggleButtonGroup.json +9 -0
- package/data/docs/types/ToggleButtonGroupButton.json +331 -0
- package/data/docs/types/ToggleButtonGroupRoot.json +269 -0
- package/data/docs/types/Toolbar.json +176 -0
- package/data/docs/types/Tooltip.json +12 -0
- package/data/docs/types/TooltipContent.json +372 -0
- package/data/docs/types/TooltipRoot.json +179 -0
- package/data/docs/types/Trigger.json +69 -0
- package/data/docs/types/VisuallyHidden.json +93 -0
- package/data/docs/types/__object.json +12 -0
- package/data/docs/types/filters.json +11 -0
- package/data/docs/types/manifest.json +278 -0
- package/data/docs/types/toast.json +234 -0
- package/data/docs/types/useColorMode.json +13 -0
- package/data/docs/types/useColorModeValue.json +13 -0
- package/data/docs/types/useColorScheme.json +12 -0
- package/data/docs/types/useLocalizedStringFormatter.json +14 -0
- package/data/icons.json +21940 -0
- package/data/tokens.json +40061 -0
- package/dist/index.js +2516 -17
- package/package.json +25 -6
- package/dist/data-loader.d.ts +0 -102
- package/dist/data-loader.js +0 -104
- package/dist/index.d.ts +0 -13
- package/dist/server.d.ts +0 -9
- package/dist/server.js +0 -22
- package/dist/server.spec.d.ts +0 -1
- package/dist/server.spec.js +0 -69
- package/dist/tools/list-components.d.ts +0 -9
- package/dist/tools/list-components.js +0 -42
- package/dist/types.d.ts +0 -28
- package/dist/types.js +0 -4
- package/src/data-loader.ts +0 -226
- package/src/index.ts +0 -29
- package/src/server.spec.ts +0 -86
- package/src/server.ts +0 -28
- package/src/tools/list-components.ts +0 -49
- package/src/types.ts +0 -31
- package/tsconfig.json +0 -14
- package/vitest.config.ts +0 -9
|
@@ -0,0 +1,594 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"id": "Components-IconToggleButton",
|
|
4
|
+
"title": "Icon toggle button",
|
|
5
|
+
"exportName": "IconToggleButton",
|
|
6
|
+
"description": "An interactive icon button that toggles between two binary states such as active and inactive.",
|
|
7
|
+
"lifecycleState": "Stable",
|
|
8
|
+
"order": 999,
|
|
9
|
+
"repoPath": "packages/nimbus/src/components/icon-toggle-button/icon-toggle-button.mdx",
|
|
10
|
+
"menu": [
|
|
11
|
+
"Components",
|
|
12
|
+
"Buttons",
|
|
13
|
+
"Icon toggle button"
|
|
14
|
+
],
|
|
15
|
+
"route": "components/buttons/icon-toggle-button",
|
|
16
|
+
"tags": [
|
|
17
|
+
"component",
|
|
18
|
+
"buttons",
|
|
19
|
+
"toggle",
|
|
20
|
+
"icon",
|
|
21
|
+
"controls"
|
|
22
|
+
],
|
|
23
|
+
"toc": [
|
|
24
|
+
{
|
|
25
|
+
"value": "Overview",
|
|
26
|
+
"href": "#overview",
|
|
27
|
+
"depth": 2,
|
|
28
|
+
"numbering": [
|
|
29
|
+
1,
|
|
30
|
+
1
|
|
31
|
+
],
|
|
32
|
+
"parent": "root"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"value": "Resources",
|
|
36
|
+
"href": "#resources",
|
|
37
|
+
"depth": 3,
|
|
38
|
+
"numbering": [
|
|
39
|
+
1,
|
|
40
|
+
1,
|
|
41
|
+
1
|
|
42
|
+
],
|
|
43
|
+
"parent": "root"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"value": "Variables",
|
|
47
|
+
"href": "#variables",
|
|
48
|
+
"depth": 2,
|
|
49
|
+
"numbering": [
|
|
50
|
+
1,
|
|
51
|
+
2
|
|
52
|
+
],
|
|
53
|
+
"parent": "root"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"value": "Visuals",
|
|
57
|
+
"href": "#visuals",
|
|
58
|
+
"depth": 3,
|
|
59
|
+
"numbering": [
|
|
60
|
+
1,
|
|
61
|
+
2,
|
|
62
|
+
1
|
|
63
|
+
],
|
|
64
|
+
"parent": "root"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"value": "Outlined",
|
|
68
|
+
"href": "#outlined",
|
|
69
|
+
"depth": 4,
|
|
70
|
+
"numbering": [
|
|
71
|
+
1,
|
|
72
|
+
2,
|
|
73
|
+
1,
|
|
74
|
+
1
|
|
75
|
+
],
|
|
76
|
+
"parent": "root"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"value": "Ghost",
|
|
80
|
+
"href": "#ghost",
|
|
81
|
+
"depth": 4,
|
|
82
|
+
"numbering": [
|
|
83
|
+
1,
|
|
84
|
+
2,
|
|
85
|
+
1,
|
|
86
|
+
2
|
|
87
|
+
],
|
|
88
|
+
"parent": "root"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"value": "Size",
|
|
92
|
+
"href": "#size",
|
|
93
|
+
"depth": 3,
|
|
94
|
+
"numbering": [
|
|
95
|
+
1,
|
|
96
|
+
2,
|
|
97
|
+
2
|
|
98
|
+
],
|
|
99
|
+
"parent": "root"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"figmaLink": "https://www.figma.com/design/AvtPX6g7OGGCRvNlatGOIY/NIMBUS-design-system?node-id=5921-47629&m=dev",
|
|
103
|
+
"layout": "app-frame",
|
|
104
|
+
"tabs": [
|
|
105
|
+
{
|
|
106
|
+
"key": "overview",
|
|
107
|
+
"title": "Overview",
|
|
108
|
+
"order": 0
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"key": "guidelines",
|
|
112
|
+
"title": "Guidelines",
|
|
113
|
+
"order": 2
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"key": "dev",
|
|
117
|
+
"title": "Implementation",
|
|
118
|
+
"order": 3
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"key": "a11y",
|
|
122
|
+
"title": "Accessibility",
|
|
123
|
+
"order": 4
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"mdx": "\n## Overview\n\nAn icon toggle button is used similarly to a checkbox or a radio button, but\nsupports a smaller interactive component that can be used to give a binary\nactive state choice to users that can be used alone or in combination with other\nchoices. A toggle button or icon toggle button gives a user a new way of\nvisualizing the information in the interface. It does not typically perform an\naction. Please use a button or an icon button for these uses.\n\n### Resources\n\nDeep dive into implementation details and access the Nimbus design library.\n\n[Figma library](https://www.figma.com/design/AvtPX6g7OGGCRvNlatGOIY/NIMBUS-design-system?node-id=5921-47629&m=dev)\n\n## Variables\n\nGet familiar with the features.\n\n### Visuals\n\n#### Outlined\n\nMost common styling of the icon toggle button.\n\n```jsx live\nconst App = () => (\n <IconToggleButton variant=\"outline\" aria-label=\"Pin item\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n)\n```\n\n#### Ghost\n\nGhost styled buttons are helpful for UI simplification.\n\n```jsx live\nconst App = () => (\n <IconToggleButton variant=\"ghost\" aria-label=\"Pin item\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n)\n```\n\n### Size\n\nThere are three sizes to icon toggle buttons, the default size is medium (md),\nextra small (xs), and 2x-small (2xs).\n\n```jsx live\nconst App = () => (\n <Stack direction=\"row\" gap=\"400\">\n <IconToggleButton size=\"md\" aria-label=\"Pin favorite\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n <IconToggleButton size=\"xs\" aria-label=\"Pin favorite\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n <IconToggleButton size=\"2xs\" aria-label=\"Pin favorite\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n </Stack>\n)\n```\n",
|
|
128
|
+
"views": {
|
|
129
|
+
"overview": {
|
|
130
|
+
"mdx": "\n## Overview\n\nAn icon toggle button is used similarly to a checkbox or a radio button, but\nsupports a smaller interactive component that can be used to give a binary\nactive state choice to users that can be used alone or in combination with other\nchoices. A toggle button or icon toggle button gives a user a new way of\nvisualizing the information in the interface. It does not typically perform an\naction. Please use a button or an icon button for these uses.\n\n### Resources\n\nDeep dive into implementation details and access the Nimbus design library.\n\n[Figma library](https://www.figma.com/design/AvtPX6g7OGGCRvNlatGOIY/NIMBUS-design-system?node-id=5921-47629&m=dev)\n\n## Variables\n\nGet familiar with the features.\n\n### Visuals\n\n#### Outlined\n\nMost common styling of the icon toggle button.\n\n```jsx live\nconst App = () => (\n <IconToggleButton variant=\"outline\" aria-label=\"Pin item\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n)\n```\n\n#### Ghost\n\nGhost styled buttons are helpful for UI simplification.\n\n```jsx live\nconst App = () => (\n <IconToggleButton variant=\"ghost\" aria-label=\"Pin item\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n)\n```\n\n### Size\n\nThere are three sizes to icon toggle buttons, the default size is medium (md),\nextra small (xs), and 2x-small (2xs).\n\n```jsx live\nconst App = () => (\n <Stack direction=\"row\" gap=\"400\">\n <IconToggleButton size=\"md\" aria-label=\"Pin favorite\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n <IconToggleButton size=\"xs\" aria-label=\"Pin favorite\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n <IconToggleButton size=\"2xs\" aria-label=\"Pin favorite\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n </Stack>\n)\n```\n",
|
|
131
|
+
"toc": [
|
|
132
|
+
{
|
|
133
|
+
"value": "Overview",
|
|
134
|
+
"href": "#overview",
|
|
135
|
+
"depth": 2,
|
|
136
|
+
"numbering": [
|
|
137
|
+
1,
|
|
138
|
+
1
|
|
139
|
+
],
|
|
140
|
+
"parent": "root"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"value": "Resources",
|
|
144
|
+
"href": "#resources",
|
|
145
|
+
"depth": 3,
|
|
146
|
+
"numbering": [
|
|
147
|
+
1,
|
|
148
|
+
1,
|
|
149
|
+
1
|
|
150
|
+
],
|
|
151
|
+
"parent": "root"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"value": "Variables",
|
|
155
|
+
"href": "#variables",
|
|
156
|
+
"depth": 2,
|
|
157
|
+
"numbering": [
|
|
158
|
+
1,
|
|
159
|
+
2
|
|
160
|
+
],
|
|
161
|
+
"parent": "root"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"value": "Visuals",
|
|
165
|
+
"href": "#visuals",
|
|
166
|
+
"depth": 3,
|
|
167
|
+
"numbering": [
|
|
168
|
+
1,
|
|
169
|
+
2,
|
|
170
|
+
1
|
|
171
|
+
],
|
|
172
|
+
"parent": "root"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"value": "Outlined",
|
|
176
|
+
"href": "#outlined",
|
|
177
|
+
"depth": 4,
|
|
178
|
+
"numbering": [
|
|
179
|
+
1,
|
|
180
|
+
2,
|
|
181
|
+
1,
|
|
182
|
+
1
|
|
183
|
+
],
|
|
184
|
+
"parent": "root"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"value": "Ghost",
|
|
188
|
+
"href": "#ghost",
|
|
189
|
+
"depth": 4,
|
|
190
|
+
"numbering": [
|
|
191
|
+
1,
|
|
192
|
+
2,
|
|
193
|
+
1,
|
|
194
|
+
2
|
|
195
|
+
],
|
|
196
|
+
"parent": "root"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"value": "Size",
|
|
200
|
+
"href": "#size",
|
|
201
|
+
"depth": 3,
|
|
202
|
+
"numbering": [
|
|
203
|
+
1,
|
|
204
|
+
2,
|
|
205
|
+
2
|
|
206
|
+
],
|
|
207
|
+
"parent": "root"
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
"a11y": {
|
|
212
|
+
"mdx": "\n## Accessibility\n\nAccessibility ensures that digital content and functionality are usable by\neveryone, including people with disabilities, by addressing visual, auditory,\ncognitive, and physical limitations.\n\n```jsx live\nconst App = () => (\n <IconToggleButton aria-label=\"Toggle favorite\">\n <Icons.SentimentSatisfied />\n </IconToggleButton>\n)\n```\n\n### Accessibility standards\n\n- **Use aria-pressed:** The most crucial accessibility attribute for a icon\n toggle button is `aria-pressed`. When the button is \"on,\" set\n `aria-pressed=\"true\"`. When it's \"off,\" set `aria-pressed=\"false\"`. This tells\n screen readers that the button's function is to toggle.\n- **Provide a clear aria-label:** Since the button lacks visible text, provide a\n descriptive `aria-label` (e.g., `aria-label=\"Toggle Bold\"` or\n `aria-label=\"Show Advanced Settings\"`). This is what a screen reader will\n announce to the user.\n- **Ensure keyboard operability:** Users must be able to navigate to the button\n using the Tab key and toggle its state using the Enter or Spacebar keys.\n",
|
|
213
|
+
"toc": [
|
|
214
|
+
{
|
|
215
|
+
"value": "Accessibility",
|
|
216
|
+
"href": "#accessibility",
|
|
217
|
+
"depth": 2,
|
|
218
|
+
"numbering": [
|
|
219
|
+
1,
|
|
220
|
+
1
|
|
221
|
+
],
|
|
222
|
+
"parent": "root"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"value": "Accessibility standards",
|
|
226
|
+
"href": "#accessibility-standards",
|
|
227
|
+
"depth": 3,
|
|
228
|
+
"numbering": [
|
|
229
|
+
1,
|
|
230
|
+
1,
|
|
231
|
+
1
|
|
232
|
+
],
|
|
233
|
+
"parent": "root"
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
"dev": {
|
|
238
|
+
"mdx": "\n## Getting started\n\n### Import\n\n```tsx\nimport { IconToggleButton, type IconToggleButtonProps } from '@commercetools/nimbus';\n```\n\n### Basic usage\n\nThe IconToggleButton component is a specialized toggle button designed for icon-only interactions. It extends the ToggleButton component with required accessibility labeling for icon content.\n\n```jsx live-dev\nconst App = () => (\n <IconToggleButton aria-label=\"Like\" onChange={(isSelected) => console.log(isSelected)}>\n <Icons.ThumbUp />\n </IconToggleButton>\n)\n```\n\n## Usage examples\n\n### Visual variants\n\nIconToggleButton supports two visual variants. The `outline` variant is the default.\n\n```jsx live-dev\nconst App = () => (\n <Stack direction=\"row\" gap=\"400\" alignItems=\"center\">\n <IconToggleButton variant=\"outline\" aria-label=\"Star (outline)\">\n <Icons.Star />\n </IconToggleButton>\n <IconToggleButton variant=\"ghost\" aria-label=\"Star (ghost)\">\n <Icons.Star />\n </IconToggleButton>\n </Stack>\n)\n```\n\n### Size options\n\nIconToggleButton supports three size variants. The `md` size is the default.\n\n```jsx live-dev\nconst App = () => (\n <Stack direction=\"row\" gap=\"400\" alignItems=\"center\">\n <IconToggleButton size=\"2xs\" aria-label=\"Bookmark (2xs)\">\n <Icons.Bookmark />\n </IconToggleButton>\n <IconToggleButton size=\"xs\" aria-label=\"Bookmark (xs)\">\n <Icons.Bookmark />\n </IconToggleButton>\n <IconToggleButton size=\"md\" aria-label=\"Bookmark (md)\">\n <Icons.Bookmark />\n </IconToggleButton>\n </Stack>\n)\n```\n\n### Color palette options\n\nUse color palettes to convey meaning and state. The `primary` color palette is the default.\n\n```jsx live-dev\nconst App = () => (\n <Stack direction=\"row\" gap=\"400\" wrap=\"wrap\">\n <IconToggleButton colorPalette=\"primary\" aria-label=\"Like (primary)\">\n <Icons.ThumbUp />\n </IconToggleButton>\n <IconToggleButton colorPalette=\"critical\" aria-label=\"Like (critical)\">\n <Icons.ThumbUp />\n </IconToggleButton>\n <IconToggleButton colorPalette=\"info\" aria-label=\"Like (info)\">\n <Icons.Star />\n </IconToggleButton>\n <IconToggleButton colorPalette=\"positive\" aria-label=\"Like (positive)\">\n <Icons.ThumbUp />\n </IconToggleButton>\n </Stack>\n)\n```\n\n### Controlled state\n\nUse `isSelected` and `onChange` to control the toggle state explicitly. This pattern is useful when you need to synchronize state with other parts of your application.\n\n```jsx live-dev\nconst App = () => {\n const [isLiked, setIsLiked] = useState(false);\n\n return (\n <Stack direction=\"row\" gap=\"400\" alignItems=\"center\">\n <IconToggleButton\n isSelected={isLiked}\n onChange={setIsLiked}\n aria-label=\"Like\"\n colorPalette=\"critical\"\n >\n <Icons.ThumbUp />\n </IconToggleButton>\n <Text>Status: {isLiked ? 'Liked' : 'Not liked'}</Text>\n </Stack>\n );\n}\n```\n\n### Uncontrolled state\n\nUse `defaultSelected` for uncontrolled mode when you don't need to track the state externally.\n\n```jsx live-dev\nconst App = () => (\n <Stack direction=\"row\" gap=\"400\" alignItems=\"center\">\n <IconToggleButton\n defaultSelected={true}\n onChange={(isSelected) => console.log('Changed to:', isSelected)}\n aria-label=\"Star\"\n colorPalette=\"info\"\n >\n <Icons.Star />\n </IconToggleButton>\n <Text fontSize=\"sm\">Check console for state changes</Text>\n </Stack>\n)\n```\n\n### Disabled state\n\nUse the `isDisabled` prop to prevent interaction. This removes the button from the tab order and prevents state changes.\n\n```jsx live-dev\nconst App = () => (\n <Stack direction=\"row\" gap=\"400\" alignItems=\"center\">\n <IconToggleButton isDisabled aria-label=\"Like (disabled)\">\n <Icons.ThumbUp />\n </IconToggleButton>\n <IconToggleButton isDisabled isSelected aria-label=\"Like (disabled selected)\">\n <Icons.ThumbUp />\n </IconToggleButton>\n </Stack>\n)\n```\n\n### Multiple toggle buttons\n\nA common pattern for managing multiple independent toggle states:\n\n```jsx live-dev\nconst App = () => {\n const [liked, setLiked] = useState(false);\n const [starred, setStarred] = useState(false);\n const [bookmarked, setBookmarked] = useState(false);\n\n return (\n <Stack direction=\"row\" gap=\"200\" alignItems=\"center\">\n <IconToggleButton\n isSelected={liked}\n onChange={setLiked}\n aria-label=\"Like\"\n colorPalette=\"critical\"\n >\n <Icons.ThumbUp />\n </IconToggleButton>\n <IconToggleButton\n isSelected={starred}\n onChange={setStarred}\n aria-label=\"Star\"\n colorPalette=\"info\"\n >\n <Icons.Star />\n </IconToggleButton>\n <IconToggleButton\n isSelected={bookmarked}\n onChange={setBookmarked}\n aria-label=\"Bookmark\"\n >\n <Icons.Bookmark />\n </IconToggleButton>\n </Stack>\n );\n}\n```\n\n## Component requirements\n\n## Accessibility\n\nThe IconToggleButton component requires explicit accessibility labeling since it contains only an icon without visible text.\n\n- **Labeling (REQUIRED)**: Always provide an `aria-label` that describes the button's action. The label should be descriptive enough to convey the button's purpose without visual context.\n- **Role**: Automatically assigned `role=\"button\"` with `aria-pressed` to indicate toggle state.\n- **State announcements**: Screen readers announce the pressed/unpressed state when toggled.\n\n```tsx\n// Good - Clear, action-oriented label\n<IconToggleButton aria-label=\"Like this post\">\n <Icons.ThumbUp />\n</IconToggleButton>\n\n// Good - Context-specific label\n<IconToggleButton aria-label=\"Add to favorites\">\n <Icons.Star />\n</IconToggleButton>\n\n// Bad - Too generic\n<IconToggleButton aria-label=\"Icon\">\n <Icons.ThumbUp />\n</IconToggleButton>\n```\n\nIf your use case requires tracking and analytics for this component, it is good practice to add a **persistent**, **unique** id:\n\n```tsx\nconst PERSISTENT_ID = \"post-like-toggle\";\n\nexport const Example = () => (\n <IconToggleButton id={PERSISTENT_ID} aria-label=\"Like\">\n <Icons.ThumbUp />\n </IconToggleButton>\n);\n```\n\n#### Keyboard navigation\n\nThe component supports full keyboard interaction:\n- `Tab`: Focuses the button\n- `Enter` or `Space`: Toggles the button state (triggers `onChange`)\n\n## API reference\n\n<PropsTable id=\"IconToggleButton\" />\n\n## Common patterns\n\n### Like/favorite buttons\n\nA common use case for toggle buttons in social features:\n\n```jsx live-dev\nconst App = () => {\n const [likeCount, setLikeCount] = useState(42);\n const [isLiked, setIsLiked] = useState(false);\n\n const handleLikeToggle = (selected) => {\n setIsLiked(selected);\n setLikeCount((count) => selected ? count + 1 : count - 1);\n };\n\n return (\n <Stack direction=\"row\" gap=\"300\" alignItems=\"center\">\n <IconToggleButton\n isSelected={isLiked}\n onChange={handleLikeToggle}\n aria-label={isLiked ? \"Unlike\" : \"Like\"}\n colorPalette=\"critical\"\n >\n <Icons.ThumbUp />\n </IconToggleButton>\n <Text fontSize=\"sm\">{likeCount} likes</Text>\n </Stack>\n );\n}\n```\n\n### Toolbar actions\n\nToggle buttons work well in toolbars for formatting and view options:\n\n```jsx live-dev\nconst App = () => {\n const [bold, setBold] = useState(false);\n const [italic, setItalic] = useState(false);\n const [underline, setUnderline] = useState(false);\n\n return (\n <Stack direction=\"column\" gap=\"400\">\n <Stack direction=\"row\" gap=\"100\" alignItems=\"center\">\n <IconToggleButton\n isSelected={bold}\n onChange={setBold}\n aria-label=\"Toggle bold\"\n variant=\"ghost\"\n >\n <Icons.FormatBold />\n </IconToggleButton>\n <IconToggleButton\n isSelected={italic}\n onChange={setItalic}\n aria-label=\"Toggle italic\"\n variant=\"ghost\"\n >\n <Icons.FormatItalic />\n </IconToggleButton>\n <IconToggleButton\n isSelected={underline}\n onChange={setUnderline}\n aria-label=\"Toggle underline\"\n variant=\"ghost\"\n >\n <Icons.FormatUnderlined />\n </IconToggleButton>\n </Stack>\n <Text fontSize=\"sm\">\n Active: {[bold && 'Bold', italic && 'Italic', underline && 'Underline'].filter(Boolean).join(', ') || 'None'}\n </Text>\n </Stack>\n );\n}\n```\n\n\n\n### Async state updates\n\nHandle asynchronous operations when toggling state:\n\n```jsx live-dev\nconst App = () => {\n const [isSubscribed, setIsSubscribed] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n\n const handleToggle = async (selected) => {\n setIsLoading(true);\n // Simulate API call\n await new Promise(resolve => setTimeout(resolve, 1000));\n setIsSubscribed(selected);\n setIsLoading(false);\n };\n\n return (\n <Stack direction=\"row\" gap=\"400\" alignItems=\"center\">\n <IconToggleButton\n isSelected={isSubscribed}\n onChange={handleToggle}\n isDisabled={isLoading}\n aria-label={isSubscribed ? \"Unsubscribe\" : \"Subscribe\"}\n colorPalette=\"info\"\n >\n <Icons.Notifications />\n </IconToggleButton>\n <Text fontSize=\"sm\">\n {isLoading ? 'Processing...' : isSubscribed ? 'Subscribed' : 'Not subscribed'}\n </Text>\n </Stack>\n );\n}\n```\n\n## Testing your implementation\n\nThese examples demonstrate how to test your implementation when using IconToggleButton in your application. As the component's internal functionality is already tested by Nimbus, these patterns help you verify your integration and application-specific logic.\n\n### Basic Rendering Tests\n\nVerify the component renders with expected accessibility attributes\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { IconToggleButton, NimbusProvider } from \"@commercetools/nimbus\";\nimport { ThumbUp } from \"@commercetools/nimbus-icons\";\n\ndescribe(\"IconToggleButton - Basic rendering\", () => {\n it(\"renders with aria-label\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like this post\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n expect(\n screen.getByRole(\"button\", { name: /like this post/i })\n ).toBeInTheDocument();\n });\n\n it(\"renders with pressed state attribute\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\", { name: /like/i });\n expect(button).toHaveAttribute(\"aria-pressed\", \"false\");\n });\n\n it(\"renders unselected by default\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Star\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n expect(button).toHaveAttribute(\"aria-pressed\", \"false\");\n });\n});\n```\n\n### Selection State Tests\n\nTest different selection states (selected/unselected)\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { IconToggleButton, NimbusProvider } from \"@commercetools/nimbus\";\nimport { ThumbUp } from \"@commercetools/nimbus-icons\";\n\ndescribe(\"IconToggleButton - Selection states\", () => {\n it(\"renders selected state\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\" isSelected>\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n expect(button).toHaveAttribute(\"aria-pressed\", \"true\");\n });\n\n it(\"renders unselected state explicitly\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\" isSelected={false}>\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n expect(button).toHaveAttribute(\"aria-pressed\", \"false\");\n });\n\n it(\"applies default selected state\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Star\" defaultSelected>\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n expect(button).toHaveAttribute(\"aria-pressed\", \"true\");\n });\n});\n```\n\n### Interaction Tests\n\nTest user interactions with the component\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { IconToggleButton, NimbusProvider } from \"@commercetools/nimbus\";\nimport { ThumbUp } from \"@commercetools/nimbus-icons\";\n\ndescribe(\"IconToggleButton - Interactions\", () => {\n it(\"toggles when clicked\", async () => {\n const user = userEvent.setup();\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n expect(button).toHaveAttribute(\"aria-pressed\", \"false\");\n\n await user.click(button);\n\n expect(button).toHaveAttribute(\"aria-pressed\", \"true\");\n });\n\n it(\"calls onChange callback when toggled\", async () => {\n const user = userEvent.setup();\n const handleChange = vi.fn();\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Star\" onChange={handleChange}>\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n await user.click(button);\n\n expect(handleChange).toHaveBeenCalledWith(true);\n });\n\n it(\"toggles with spacebar when focused\", async () => {\n const user = userEvent.setup();\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Bookmark\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n // Use userEvent.tab() instead of element.focus() to avoid act() warnings\n await user.tab();\n await user.keyboard(\" \");\n\n expect(screen.getByRole(\"button\")).toHaveAttribute(\"aria-pressed\", \"true\");\n });\n\n it(\"toggles with enter key when focused\", async () => {\n const user = userEvent.setup();\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n // Use userEvent.tab() instead of element.focus() to avoid act() warnings\n await user.tab();\n await user.keyboard(\"{Enter}\");\n\n expect(screen.getByRole(\"button\")).toHaveAttribute(\"aria-pressed\", \"true\");\n });\n});\n```\n\n### Testing Controlled Mode\n\nTest controlled component behavior\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { IconToggleButton, NimbusProvider } from \"@commercetools/nimbus\";\nimport { ThumbUp } from \"@commercetools/nimbus-icons\";\n\ndescribe(\"IconToggleButton - Controlled mode\", () => {\n it(\"displays controlled value\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton\n aria-label=\"Like\"\n isSelected={true}\n onChange={() => {}}\n >\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n expect(button).toHaveAttribute(\"aria-pressed\", \"true\");\n });\n\n it(\"updates when controlled value changes\", () => {\n const { rerender } = render(\n <NimbusProvider>\n <IconToggleButton\n aria-label=\"Star\"\n isSelected={false}\n onChange={() => {}}\n >\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n expect(screen.getByRole(\"button\")).toHaveAttribute(\"aria-pressed\", \"false\");\n\n rerender(\n <NimbusProvider>\n <IconToggleButton\n aria-label=\"Star\"\n isSelected={true}\n onChange={() => {}}\n >\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n expect(screen.getByRole(\"button\")).toHaveAttribute(\"aria-pressed\", \"true\");\n });\n\n it(\"calls onChange when user interacts with controlled button\", async () => {\n const user = userEvent.setup();\n const handleChange = vi.fn();\n render(\n <NimbusProvider>\n <IconToggleButton\n aria-label=\"Like\"\n isSelected={false}\n onChange={handleChange}\n >\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n await user.click(button);\n\n expect(handleChange).toHaveBeenCalledWith(true);\n });\n});\n```\n\n### Testing Validation States\n\nTest different validation and state variations\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { IconToggleButton, NimbusProvider } from \"@commercetools/nimbus\";\nimport { ThumbUp } from \"@commercetools/nimbus-icons\";\n\ndescribe(\"IconToggleButton - Validation states\", () => {\n it(\"renders disabled state\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\" isDisabled>\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n expect(button).toBeDisabled();\n });\n\n it(\"does not toggle when disabled\", async () => {\n const user = userEvent.setup();\n const handleChange = vi.fn();\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Star\" isDisabled onChange={handleChange}>\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n await user.click(button);\n\n expect(button).toHaveAttribute(\"aria-pressed\", \"false\");\n expect(handleChange).not.toHaveBeenCalled();\n });\n\n it(\"renders selected and disabled state\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\" isSelected isDisabled>\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n const button = screen.getByRole(\"button\");\n expect(button).toHaveAttribute(\"aria-pressed\", \"true\");\n expect(button).toBeDisabled();\n });\n});\n```\n\n### Testing Visual Variants\n\nTest that different visual variants render correctly\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { IconToggleButton, NimbusProvider } from \"@commercetools/nimbus\";\nimport { ThumbUp } from \"@commercetools/nimbus-icons\";\n\ndescribe(\"IconToggleButton - Visual variants\", () => {\n it(\"renders outline variant\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\" variant=\"outline\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n expect(screen.getByRole(\"button\")).toBeInTheDocument();\n });\n\n it(\"renders ghost variant\", () => {\n render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Star\" variant=\"ghost\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n expect(screen.getByRole(\"button\")).toBeInTheDocument();\n });\n\n it(\"renders different size variants\", () => {\n const { rerender } = render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\" size=\"2xs\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n expect(screen.getByRole(\"button\")).toBeInTheDocument();\n\n rerender(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\" size=\"xs\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n expect(screen.getByRole(\"button\")).toBeInTheDocument();\n\n rerender(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\" size=\"md\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n expect(screen.getByRole(\"button\")).toBeInTheDocument();\n });\n\n it(\"renders with different color palettes\", () => {\n const { rerender } = render(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\" colorPalette=\"primary\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n expect(screen.getByRole(\"button\")).toBeInTheDocument();\n\n rerender(\n <NimbusProvider>\n <IconToggleButton aria-label=\"Like\" colorPalette=\"critical\">\n <ThumbUp />\n </IconToggleButton>\n </NimbusProvider>\n );\n\n expect(screen.getByRole(\"button\")).toBeInTheDocument();\n });\n});\n```\n\n\n## Resources\n\n- [Storybook](https://nimbus-storybook.vercel.app/?path=/docs/components-buttons-icontogglebutton--docs)\n- [React Aria ToggleButton](https://react-spectrum.adobe.com/react-aria/ToggleButton.html)\n",
|
|
239
|
+
"toc": [
|
|
240
|
+
{
|
|
241
|
+
"value": "Getting started",
|
|
242
|
+
"href": "#getting-started",
|
|
243
|
+
"depth": 2,
|
|
244
|
+
"numbering": [
|
|
245
|
+
1,
|
|
246
|
+
1
|
|
247
|
+
],
|
|
248
|
+
"parent": "root"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"value": "Import",
|
|
252
|
+
"href": "#import",
|
|
253
|
+
"depth": 3,
|
|
254
|
+
"numbering": [
|
|
255
|
+
1,
|
|
256
|
+
1,
|
|
257
|
+
1
|
|
258
|
+
],
|
|
259
|
+
"parent": "root"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"value": "Basic usage",
|
|
263
|
+
"href": "#basic-usage",
|
|
264
|
+
"depth": 3,
|
|
265
|
+
"numbering": [
|
|
266
|
+
1,
|
|
267
|
+
1,
|
|
268
|
+
2
|
|
269
|
+
],
|
|
270
|
+
"parent": "root"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"value": "Usage examples",
|
|
274
|
+
"href": "#usage-examples",
|
|
275
|
+
"depth": 2,
|
|
276
|
+
"numbering": [
|
|
277
|
+
1,
|
|
278
|
+
2
|
|
279
|
+
],
|
|
280
|
+
"parent": "root"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"value": "Visual variants",
|
|
284
|
+
"href": "#visual-variants",
|
|
285
|
+
"depth": 3,
|
|
286
|
+
"numbering": [
|
|
287
|
+
1,
|
|
288
|
+
2,
|
|
289
|
+
1
|
|
290
|
+
],
|
|
291
|
+
"parent": "root"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"value": "Size options",
|
|
295
|
+
"href": "#size-options",
|
|
296
|
+
"depth": 3,
|
|
297
|
+
"numbering": [
|
|
298
|
+
1,
|
|
299
|
+
2,
|
|
300
|
+
2
|
|
301
|
+
],
|
|
302
|
+
"parent": "root"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"value": "Color palette options",
|
|
306
|
+
"href": "#color-palette-options",
|
|
307
|
+
"depth": 3,
|
|
308
|
+
"numbering": [
|
|
309
|
+
1,
|
|
310
|
+
2,
|
|
311
|
+
3
|
|
312
|
+
],
|
|
313
|
+
"parent": "root"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"value": "Controlled state",
|
|
317
|
+
"href": "#controlled-state",
|
|
318
|
+
"depth": 3,
|
|
319
|
+
"numbering": [
|
|
320
|
+
1,
|
|
321
|
+
2,
|
|
322
|
+
4
|
|
323
|
+
],
|
|
324
|
+
"parent": "root"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"value": "Uncontrolled state",
|
|
328
|
+
"href": "#uncontrolled-state",
|
|
329
|
+
"depth": 3,
|
|
330
|
+
"numbering": [
|
|
331
|
+
1,
|
|
332
|
+
2,
|
|
333
|
+
5
|
|
334
|
+
],
|
|
335
|
+
"parent": "root"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"value": "Disabled state",
|
|
339
|
+
"href": "#disabled-state",
|
|
340
|
+
"depth": 3,
|
|
341
|
+
"numbering": [
|
|
342
|
+
1,
|
|
343
|
+
2,
|
|
344
|
+
6
|
|
345
|
+
],
|
|
346
|
+
"parent": "root"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"value": "Multiple toggle buttons",
|
|
350
|
+
"href": "#multiple-toggle-buttons",
|
|
351
|
+
"depth": 3,
|
|
352
|
+
"numbering": [
|
|
353
|
+
1,
|
|
354
|
+
2,
|
|
355
|
+
7
|
|
356
|
+
],
|
|
357
|
+
"parent": "root"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"value": "Component requirements",
|
|
361
|
+
"href": "#component-requirements",
|
|
362
|
+
"depth": 2,
|
|
363
|
+
"numbering": [
|
|
364
|
+
1,
|
|
365
|
+
3
|
|
366
|
+
],
|
|
367
|
+
"parent": "root"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"value": "Accessibility",
|
|
371
|
+
"href": "#accessibility",
|
|
372
|
+
"depth": 2,
|
|
373
|
+
"numbering": [
|
|
374
|
+
1,
|
|
375
|
+
4
|
|
376
|
+
],
|
|
377
|
+
"parent": "root"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"value": "Keyboard navigation",
|
|
381
|
+
"href": "#keyboard-navigation",
|
|
382
|
+
"depth": 4,
|
|
383
|
+
"numbering": [
|
|
384
|
+
1,
|
|
385
|
+
4,
|
|
386
|
+
1,
|
|
387
|
+
1
|
|
388
|
+
],
|
|
389
|
+
"parent": "root"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"value": "API reference",
|
|
393
|
+
"href": "#api-reference",
|
|
394
|
+
"depth": 2,
|
|
395
|
+
"numbering": [
|
|
396
|
+
1,
|
|
397
|
+
5
|
|
398
|
+
],
|
|
399
|
+
"parent": "root"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"value": "Common patterns",
|
|
403
|
+
"href": "#common-patterns",
|
|
404
|
+
"depth": 2,
|
|
405
|
+
"numbering": [
|
|
406
|
+
1,
|
|
407
|
+
6
|
|
408
|
+
],
|
|
409
|
+
"parent": "root"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"value": "Like/favorite buttons",
|
|
413
|
+
"href": "#likefavorite-buttons",
|
|
414
|
+
"depth": 3,
|
|
415
|
+
"numbering": [
|
|
416
|
+
1,
|
|
417
|
+
6,
|
|
418
|
+
1
|
|
419
|
+
],
|
|
420
|
+
"parent": "root"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"value": "Toolbar actions",
|
|
424
|
+
"href": "#toolbar-actions",
|
|
425
|
+
"depth": 3,
|
|
426
|
+
"numbering": [
|
|
427
|
+
1,
|
|
428
|
+
6,
|
|
429
|
+
2
|
|
430
|
+
],
|
|
431
|
+
"parent": "root"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"value": "Async state updates",
|
|
435
|
+
"href": "#async-state-updates",
|
|
436
|
+
"depth": 3,
|
|
437
|
+
"numbering": [
|
|
438
|
+
1,
|
|
439
|
+
6,
|
|
440
|
+
3
|
|
441
|
+
],
|
|
442
|
+
"parent": "root"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"value": "Testing your implementation",
|
|
446
|
+
"href": "#testing-your-implementation",
|
|
447
|
+
"depth": 2,
|
|
448
|
+
"numbering": [
|
|
449
|
+
1,
|
|
450
|
+
7
|
|
451
|
+
],
|
|
452
|
+
"parent": "root"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"value": "Basic Rendering Tests",
|
|
456
|
+
"href": "#basic-rendering-tests",
|
|
457
|
+
"depth": 3,
|
|
458
|
+
"numbering": [
|
|
459
|
+
1,
|
|
460
|
+
7,
|
|
461
|
+
1
|
|
462
|
+
],
|
|
463
|
+
"parent": "root"
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"value": "Selection State Tests",
|
|
467
|
+
"href": "#selection-state-tests",
|
|
468
|
+
"depth": 3,
|
|
469
|
+
"numbering": [
|
|
470
|
+
1,
|
|
471
|
+
7,
|
|
472
|
+
2
|
|
473
|
+
],
|
|
474
|
+
"parent": "root"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"value": "Interaction Tests",
|
|
478
|
+
"href": "#interaction-tests",
|
|
479
|
+
"depth": 3,
|
|
480
|
+
"numbering": [
|
|
481
|
+
1,
|
|
482
|
+
7,
|
|
483
|
+
3
|
|
484
|
+
],
|
|
485
|
+
"parent": "root"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"value": "Testing Controlled Mode",
|
|
489
|
+
"href": "#testing-controlled-mode",
|
|
490
|
+
"depth": 3,
|
|
491
|
+
"numbering": [
|
|
492
|
+
1,
|
|
493
|
+
7,
|
|
494
|
+
4
|
|
495
|
+
],
|
|
496
|
+
"parent": "root"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"value": "Testing Validation States",
|
|
500
|
+
"href": "#testing-validation-states",
|
|
501
|
+
"depth": 3,
|
|
502
|
+
"numbering": [
|
|
503
|
+
1,
|
|
504
|
+
7,
|
|
505
|
+
5
|
|
506
|
+
],
|
|
507
|
+
"parent": "root"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"value": "Testing Visual Variants",
|
|
511
|
+
"href": "#testing-visual-variants",
|
|
512
|
+
"depth": 3,
|
|
513
|
+
"numbering": [
|
|
514
|
+
1,
|
|
515
|
+
7,
|
|
516
|
+
6
|
|
517
|
+
],
|
|
518
|
+
"parent": "root"
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"value": "Resources",
|
|
522
|
+
"href": "#resources",
|
|
523
|
+
"depth": 2,
|
|
524
|
+
"numbering": [
|
|
525
|
+
1,
|
|
526
|
+
8
|
|
527
|
+
],
|
|
528
|
+
"parent": "root"
|
|
529
|
+
}
|
|
530
|
+
]
|
|
531
|
+
},
|
|
532
|
+
"guidelines": {
|
|
533
|
+
"mdx": "\n## Guidelines\n\nIcon toggle button guidelines aim to provide clear and consistent visual\nfeedback to users for compact binary states.\n\n### Best practices\n\n- **Avoid setting a default toggle as active:** Instead, let users choose their\n preference. If one option is selected more frequently, make it the default,\n while still allowing users to switch to the less popular choice.\n- **Intuitive icons:** Use icons that are universally recognized for the action\n they represent. Consider adding a tooltip on hover to provide a text label to\n help a user understand what is being chosen.\n- **Maintain visual consistency:** The icon's style (line weight, color, fill)\n should be consistent with the rest of the icons in the design system to ensure\n a cohesive look and feel.\n- **Provide immediate feedback:** The button should visually respond instantly\n when a user clicks or taps it, providing reassurance that the action was\n successful.\n- **Communicate meaningful changes:** If a toggle button makes a significant\n change (ex: updating default payment) pair this toggled action with a toast\n message to better communicate the change when needed.\n\n##### Toggle Groups (Segmented Controls)\n\n- **Enforce mutual exclusivity:** Use toggle groups (segmented controls) when\n the user must select only one option from a small, defined set, similar to\n radio button behavior (e.g., alignment controls, viewing modes).\n- **Limit options:** Keep the number of options within a group small (ideally 3\n to 5) to prevent overcrowding and ensure each button is easily tappable.\n\n### Usage\n\n> [!TIP]\\\n> When to use\n\n- **Compact binary states:** Use them for on/off settings in toolbars or\n space-limited areas (e.g., toggling bold text, muting).\n- **Clear, universal actions:** Use them for actions whose icon is immediately\n understood without a text label (e.g., Pin, Star).\n- **Quick filtering:** Use them for providing quick, visual controls for\n filtering items or selecting a mode.\n- **Frequent interactions:** Use them when an action is performed often to save\n time and screen space.\n- **Instant application:** When the action takes effect immediately without\n requiring the user to press a separate \"Save\" or \"Submit\" button.\n\n> [!CAUTION]\\\n> When not to use\n\n- **Ambiguous actions:** Do not use them when the icon's meaning is unclear or\n requires the user to guess; use a text label or tooltip.\n- **Complex or multi-state processes:** Avoid using them for actions that\n require more than two states or sequential steps; use a segmented button or\n switch.\n- **Critical, permanent actions:** Do not use them for destructive or major\n actions; use a full text button with confirmation.\n- **Core navigation:** Avoid making primary navigation items toggle-able unless\n they explicitly switch between two main views.\n- **Multi-select options:** If the user can select multiple items from a list,\n use checkboxes instead.\n- **Multi-state options:** If the user needs to select one option from three or\n more choices, use radio buttons or a segmented control instead.\n- **Actions requiring confirmation:** Do not use for actions that are\n destructive, irreversible, or require confirmation (e.g., deleting an account,\n submitting a payment). Use a standard button that triggers a confirmation\n dialog.\n- **Complex settings:** Avoid using a toggle if the result of the action isn't\n clear or if the setting requires additional input fields to be configured.\n- **Triggers for new pages:** Do not use a toggle to navigate to a new section\n or page; use a link or standard button for navigation.\n- **Long-running processes:** For actions that take time to complete (e.g.,\n \"Start Backup\"), a standard button that displays a loading spinner upon press\n is more appropriate.\n\n### Icon toggle buttons in use\n\n> [!TIP]\\\n> **Do**\n>\n> - Do use icon toggle buttons for a simple binary choice (on/off).\n> - Do place them in toolbars or areas where space is limited.\n> - Do ensure the \"on\" state is clearly distinct from the \"off\" state.\n> - Do connect buttons that toggle one active state among a small selection of\n> options.\n\n```jsx live\nconst App = () => (\n <Stack direction=\"column\" alignItems=\"start\">\n <Toolbar orientation=\"horizontal\">\n <Select.Root\n size=\"sm\"\n variant=\"ghost\"\n aria-label=\"Select a text style\"\n defaultSelectedKey=\"p\"\n isClearable={false}\n >\n <Select.Options>\n <Select.Option id=\"h1\">Heading 1</Select.Option>\n <Select.Option id=\"h2\">Heading 2</Select.Option>\n <Select.Option id=\"h3\">Heading 3</Select.Option>\n <Select.Option id=\"p\">Paragraph</Select.Option>\n </Select.Options>\n </Select.Root>\n <Separator orientation=\"vertical\" />\n <Group>\n <IconToggleButton size=\"xs\" variant=\"ghost\" aria-label=\"Bold\">\n <Icons.FormatBold />\n </IconToggleButton>\n <IconToggleButton size=\"xs\" variant=\"ghost\" aria-label=\"Italic\">\n <Icons.FormatItalic />\n </IconToggleButton>\n <IconToggleButton size=\"xs\" variant=\"ghost\" aria-label=\"Underline\">\n <Icons.FormatUnderlined />\n </IconToggleButton>\n <IconButton size=\"xs\" variant=\"ghost\">\n <Icons.MoreHoriz />\n </IconButton>\n </Group>\n <Separator orientation=\"vertical\" />\n <Group>\n <IconToggleButton size=\"xs\" variant=\"ghost\" aria-label=\"Bulleted list\">\n <Icons.FormatListBulleted />\n </IconToggleButton>\n <IconToggleButton size=\"xs\" variant=\"ghost\" aria-label=\"Numbered list\">\n <Icons.FormatListNumbered />\n </IconToggleButton>\n </Group>\n </Toolbar>\n </Stack>\n);\n```\n\n> [!CAUTION]\\\n> **Don't**\n>\n> - Don't use them for multi-step processes or complex selections.\n> - Don't use an ambiguous icon without a tooltip or a text label.\n> - Don't use an icon toggle button, when you should use an icon button instead.\n\n```jsx live\nconst App = () => (\n <Stack direction=\"row\">\n <IconToggleButton aria-label=\"Sign language\">\n <Icons.SignLanguage />\n </IconToggleButton>\n <IconToggleButton aria-label=\"Delete\">\n <Icons.Delete />\n </IconToggleButton>\n <IconToggleButton aria-label=\"Copy\">\n <Icons.FileCopy />\n </IconToggleButton>\n </Stack>\n);\n```\n",
|
|
534
|
+
"toc": [
|
|
535
|
+
{
|
|
536
|
+
"value": "Guidelines",
|
|
537
|
+
"href": "#guidelines",
|
|
538
|
+
"depth": 2,
|
|
539
|
+
"numbering": [
|
|
540
|
+
1,
|
|
541
|
+
1
|
|
542
|
+
],
|
|
543
|
+
"parent": "root"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"value": "Best practices",
|
|
547
|
+
"href": "#best-practices",
|
|
548
|
+
"depth": 3,
|
|
549
|
+
"numbering": [
|
|
550
|
+
1,
|
|
551
|
+
1,
|
|
552
|
+
1
|
|
553
|
+
],
|
|
554
|
+
"parent": "root"
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
"value": "Toggle Groups (Segmented Controls)",
|
|
558
|
+
"href": "#toggle-groups-segmented-controls",
|
|
559
|
+
"depth": 5,
|
|
560
|
+
"numbering": [
|
|
561
|
+
1,
|
|
562
|
+
1,
|
|
563
|
+
1,
|
|
564
|
+
1,
|
|
565
|
+
1
|
|
566
|
+
],
|
|
567
|
+
"parent": "root"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
"value": "Usage",
|
|
571
|
+
"href": "#usage",
|
|
572
|
+
"depth": 3,
|
|
573
|
+
"numbering": [
|
|
574
|
+
1,
|
|
575
|
+
1,
|
|
576
|
+
2
|
|
577
|
+
],
|
|
578
|
+
"parent": "root"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"value": "Icon toggle buttons in use",
|
|
582
|
+
"href": "#icon-toggle-buttons-in-use",
|
|
583
|
+
"depth": 3,
|
|
584
|
+
"numbering": [
|
|
585
|
+
1,
|
|
586
|
+
1,
|
|
587
|
+
3
|
|
588
|
+
],
|
|
589
|
+
"parent": "root"
|
|
590
|
+
}
|
|
591
|
+
]
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|