Button
href — navigates while looking like a button. Seven variants, three appearances and five sizes, all drawn from theme tokens.
vig-button [vigButtonIcon]
import { Button, ButtonIcon } from '@vigdx/ui/button';Variants
variant picks the hue from the shared set: primary (default), secondary , ghost and the four status colors.
Appearances
appearance sets the emphasis: solid (default), outlined and text . Combine it with any variant.
Sizes
size runs from xs (24px) to xl (48px); md (34px) is the default control height.
Icons
vigButtonIcon . Without a label the button turns square — give it an ariaLabel ; rounded makes it a circle.
Loading and disabled
loading swaps the icon for a spinner, sets aria-busy and blocks clicks while keeping the variant colors and focus. disabled greys the button out.
Links
href the button renders an <a> . target="_blank" adds rel="noopener noreferrer" ; a disabled link drops its href and leaves the tab order.
Full width
fullWidth stretches the button across its container, e.g. in narrow forms.
All variants
| Variant | solid | outlined | text | disabled |
|---|---|---|---|---|
| primary | ||||
| secondary | ||||
| ghost | ||||
| info | ||||
| success | ||||
| warning | ||||
| error |
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="button"][data-part="control"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="button"]
| Part | Element | data-state |
|---|---|---|
control | <button> , or <a> with href . | — |
spinner | loading . | — |
icon | [vigButtonIcon] slot. | — |
Accessibility
- Renders a native
<button>(type="button"by default, so it never submits a form by accident) or, withhref, a native<a>. Both activate with Enter; buttons also with Space. - Icon-only buttons have no visible text: always pass
ariaLabel. AvigTooltipwith the same text helps sighted mouse users. loadingsetsaria-busy="true"and blocks activation, but keeps the button focusable (aria-disabled="true"instead ofdisabled), so a focused submit button that starts loading does not drop focus to the page; a disabled link getsaria-disabled="true"andtabindex="-1".- Focus is always visible: a
--shadow-focushalo on filled and outlined buttons, the offset--shadow-focus-ringon borderless ones. - Every variant meets WCAG AA contrast against its fill in the light and dark palettes.
API
Button
vig-button| Name | Type | Default | Description |
|---|---|---|---|
appearance | ButtonAppearance | 'solid' | — |
ariaLabel | string | undefined | undefined | Accessible name — required for icon-only buttons, overridable for i18n. |
autofocus | boolean | false | Sets |
disabled | boolean | false | — |
fullWidth | boolean | false | Stretches the button across its container (e.g. form submit rows). |
href | string | undefined | undefined | Renders a link ( |
label | string | undefined | undefined | — |
loading | boolean | false | Shows a spinner in place of the icon and blocks activation. The button
keeps focus while busy: it is marked |
rel | string | undefined | undefined | Link |
rounded | boolean | false | Pill shape; combined with an icon-only button it renders a circle. |
size | ButtonSize | 'md' | — |
target | string | undefined | undefined | Link target, e.g. |
type | "button" | "submit" | "reset" | 'button' | — |
variant | ButtonVariant | 'primary' | — |
Templates and directives
| Selector | Export | Description |
|---|---|---|
[vigButtonIcon] | ButtonIcon | Marks projected content as the button's leading icon. Any icon source
works (icon font |