tuix-button
The primary action button, with optional leading and trailing icons.
tuix-button is the action button of the design system. It renders a real
<button> inside its shadow root, takes its label from the default slot and
reports clicks as a customClick event.
Variants
variant picks the emphasis. There are two, and they are the same two on every
button and link in the system.
Primary
Filled with the brand colour. One per view: the action the page is for.
Secondary
Outlined. Everything next to a primary button: cancel, back, secondary actions.
With icons
iconLeft and iconRight take any icon name. The icon
colour is not configurable: it follows the label, including on hover, so the
button stays readable in both variants.
Icons render at 24px, dropping to 16px below the tablet breakpoint.
States
Disabled
disabled greys the button out and stops customClick from firing.
Full width
full stretches the button to the width of its container, which is the usual
choice on mobile and in narrow forms.
Dark
Every component but tuix-table takes a dark
property instead of reading a global theme. The previews on this site follow
the page theme, so switching the theme in the sidebar shows the dark palette.
Clicks
The click event is customClick, not click. The native click stays inside the shadow root.
API
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
variant | variant | MainVariant | primary | primary is filled, secondary is outlined |
disabled | disabled | boolean | false | Greys the button out and blocks customClick |
dark | dark | boolean | false | Dark palette |
full | full | boolean | false | Stretch to the width of the container |
iconLeft | iconleft | IconName | None | Icon before the label |
iconRight | iconright | IconName | None | Icon after the label |
variant, disabled, dark and full reflect to the attribute, so they can
be styled and inspected from outside. iconLeft and iconRight do not: they
are read from the attribute, never written back to it.
Events
| Event | Detail | When |
|---|---|---|
customClick | None | The button is clicked and not disabled. Bubbles |
Slots
| Slot | Content |
|---|---|
| default | The label. It is styled with TextSize.Button automatically |
In a framework
Every example on this page is shown in Angular, Vue or React through the tabs above it. Full setup for each: React and Next.js, Vue, Angular.