Toggle button is a custom element that allows users to toggle between two states.
To make the button acitve use the active
attribute. With a native button you can use the aria-pressed
attribute also.
You can change the shape of the toggle button by using the shape
attribute.
import { DapDSToggleButton } from 'dap-design-system/dist/dds'
import { DapDSToggleButtonReact } from 'dap-design-system/dist/react'
Property | Type | Default | Description |
---|---|---|---|
size | 'lg' , 'md' , 'sm' , 'xs' | 'md' | The size of the button |
active | boolean | false | Whether the button is active. |
shape | 'button' , 'circle' | 'button' | The shape of the button |
sizeChildren | string | 'true' |
Name | Description |
---|---|
(default) | The content of the toggle button. |
No custom events available.
Part Name | Description |
---|---|
base | The main button container. |
high-contrast | The high contrast part of the button. |
Property Name | Description |
---|---|
--dds-toggle-button-min-width-lg | Minimum width of the large toggle button |
--dds-toggle-button-min-width-md | Minimum width of the medium toggle button |
--dds-toggle-button-min-width-sm | Minimum width of the small toggle button |
--dds-toggle-button-min-width-xs | Minimum width of the extra small toggle button |
--dds-toggle-button-height-lg | Height of the large toggle button |
--dds-toggle-button-height-md | Height of the medium toggle button |
--dds-toggle-button-height-sm | Height of the small toggle button |
--dds-toggle-button-height-xs | Height of the extra small toggle button |
--dds-toggle-button-padding-lg | Padding of the large toggle button |
--dds-toggle-button-padding-md | Padding of the medium toggle button |
--dds-toggle-button-padding-sm | Padding of the small toggle button |
--dds-toggle-button-padding-xs | Padding of the extra small toggle button |
--dds-toggle-button-font-size-lg | Font size of the large toggle button |
--dds-toggle-button-font-size-md | Font size of the medium toggle button |
--dds-toggle-button-font-size-sm | Font size of the small toggle button |
--dds-toggle-button-font-size-xs | Font size of the extra small toggle button |
--dds-toggle-button-border-enabled | Border color in enabled state |
--dds-toggle-button-background-enabled | Background color in enabled state |
--dds-toggle-button-content-enabled | Content/text color in enabled state |
--dds-toggle-button-border-hover | Border color in hover state |
--dds-toggle-button-background-hover | Background color in hover state |
--dds-toggle-button-border-pressed | Border color in pressed state |
--dds-toggle-button-background-pressed | Background color in pressed state |
--dds-toggle-button-background-selected-enabled | Background color in selected enabled state |
--dds-toggle-button-content-selected-enabled | Content/text color in selected enabled state |
--dds-toggle-button-background-selected-hover | Background color in selected hover state |
--dds-toggle-button-background-selected-pressed | Background color in selected pressed state |
--dds-toggle-button-border-disabled | Border color in disabled state |
--dds-toggle-button-background-disabled | Background color in disabled state |
--dds-toggle-button-content-disabled | Content/text color in disabled state |
--dds-toggle-button-highcontrast-border | High contrast border color |
--dds-toggle-button-highcontrast-border-hover | High contrast border color on hover |