button
Trigger an event, action or operation.
Import
Import just the button styles.
@import "@winnie-ui/css/spatial/button";@import "@winnie-ui/css/visual/button";Anatomy
Attach the appropriate data attributes in the structure below.
<button data-component="button"> <i data-slot="icon"></i> <span data-slot="label"></span> <span data-slot="pending"></span> <kbd data-slot="shortcut"> <kbd data-component="kbd" /> </kbd></button>Examples
Size
Use the data-size attribute to change the size.
Variant
Use the data-variant attribute to change look of the button.
Radius
Use the data-radius attribute to change the radius.
Color
Use the data-accent-color attribute to modify the color of the button. By default the button will inherit the accent color from the closest parent that specifies the data-accent-color attribute.
Icon
Add an icon with the icon slot attribute as a child of the button.
Icon Only
Create an icon button by only passing an icon with the icon slot attribute as a child of the button.
Shortcuts
Add shortcut identifiers to your button using the shortcut slot and the kbd component. These shortcuts typically only apply to users on screens larger than 768px, so we hide them for any viewport width smaller than that.
Pending
If a child of the button is rendered with the pending attribute, any text and icons rendered in the button will be hidden and the pending slot will be rendered.
Disabled
Use the disabled attribute to prevent user interaction.
Full Width
Use the data-width attribute to modify the overall width of the button.
Reference
button
Groups all of the parts of the button together.
kbd
Single key in the shortcut slot.