Button Beta
The next-generation button directive. Applies to <button><a>tg2Button
Styles
All our different variants of buttons are set by adding the tg2Style
States
Default size · square shape. Each variant has a distinct disabled treatment.
| Resting | Hover | Focus | Active | Disabled | Loading | |
|---|---|---|---|---|---|---|
| Primary - default | ||||||
| Secondary | ||||||
| Transparent | ||||||
| Destructive | ||||||
| Expressive | ||||||
| Enhanced | ||||||
| Watchlist |
Sizes
| Primary | Secondary | Destructive | Expressive | Watchlist | |
|---|---|---|---|---|---|
| Small (32px) | |||||
| Medium (40px) | |||||
| Large (48px) |
Shapes
Icons
| Primary | Secondary | Expressive | Destructive | |
|---|---|---|---|---|
| Leading | ||||
| Trailing |
Icon only
Two mutually exclusive inputs hide a button's label — pick based on whether it should ever be visible.
| Input | Label hidden | Use when |
|---|---|---|
[iconOnly] | Always, at every viewport size | The icon alone is always enough (e.g. a bare close or delete action) |
[iconOnlyBelow]smmd | Only below that breakpoint — the full label shows above it | The label helps on larger screens but the button needs to shrink on mobile |
The label text always stays in the DOM for screen readers. iconOnlyBelow
Conditional icon + label (toggle buttons)
Icon and label as siblings inside an @if@else
Links
Apply tg2Button<a><button>
| Primary | Secondary | Transparent |
|---|---|---|
API
Selector: a[tg2Button], button[tg2Button]Tg2ButtonComponent@trademe/tangram
| Input | Values | Default | Constraints |
|---|---|---|---|
theme | tg2-lighttg2-darktg-lighttg-dark | tg2-light | |
tg2Style | primarysecondarytransparentdestructiveexpressiveenhancedwatchlist | primary | |
size | smallmediumlarge | large | Not with autoSize. |
autoSize | smallmedium | — | Not with size. |
shape | roundsquare | square | |
toggled | boolean | — | |
iconOnly | boolean | false | Not with iconOnlyBelow. |
iconOnlyBelow | smmd | — | Not with iconOnly. |
loading | boolean | false | |
fullWidth | boolean | false | Not with tag, linkStyle. |
type | buttonsubmitreset | button | |
tag | boolean | false | Not with linkStyle, fullWidth. Needs theme tg-light or tg-dark, set before this input in the template. |
linkStyle | boolean | false | Not with tag, fullWidth. Needs theme tg-light or tg-dark, set before this input in the template. |
Content slots: tg-icon, tg-icon-lefttg-icon-right