<tc-button>
A styled button with variants, sizes, disabled and loading states — and renders as an anchor when given an href.
Props
| Name | Type | Default | Description |
|---|---|---|---|
variant | "primary" | "secondary" | "ghost" | "danger" | "primary" | Visual style preset. |
size | "sm" | "md" | "lg" | "md" | Padding and font scale. |
disabled | boolean | false | Disables the control; reflects to the host attribute. |
loading | boolean | false | Shows a spinner and disables interaction. |
block | boolean | false | Full-width modifier. |
href | string | "" | When non-empty, renders an <a> with this href instead of a <button>. |
target | string | "" | Anchor target. target="_blank" auto-adds rel="noopener". |
rel | string | "" | Anchor rel attribute. Only applies when href is set. |
Events
| Event | Detail | When |
|---|---|---|
click | native MouseEvent | Fires on user click. Disabled buttons and disabled anchors do not fire it. |
Slots
| Slot | Description |
|---|---|
(default) | Button label content. Pass text, icons, or both. |
CSS variables
| Variable | Default | Description |
|---|---|---|
--tc-btn-primary-bg | var(--tc-color-ink, #14171f) | Primary background. |
--tc-btn-primary-fg | var(--tc-color-surface, #ffffff) | Primary foreground. |
--tc-btn-secondary-bg | var(--tc-color-surface, #ffffff) | Secondary background. |
--tc-btn-secondary-fg | var(--tc-color-ink, #14171f) | Secondary foreground. |
--tc-btn-secondary-border | var(--tc-color-rule-strong, #d9cfb8) | Secondary border color. |
--tc-btn-ghost-fg | var(--tc-color-ink, #14171f) | Ghost text color. |
--tc-btn-ghost-border | transparent | Ghost border (transparent by default; set to draw an outline). |
--tc-btn-danger-bg | var(--tc-color-danger, #b3261e) | Danger background. |
--tc-btn-danger-fg | var(--tc-color-surface, #ffffff) | Danger foreground. |
--tc-btn-radius | var(--tc-radius-md, 8px) | Corner radius. |
--tc-btn-font | var(--tc-font-sans, …) | Font family. |
Examples
Variants
Four built-in styles. Pick the one that matches the action's emphasis.
Sizes
Three sizes; combine with any variant.
States
disabled blocks clicks and dims the button. loading shows a spinner and also blocks interaction.
Block (full-width)
block stretches the button to fill its container — useful for mobile forms.
Anchor mode (href)
Pass href and the button renders as a real <a> instead of a <button> — same styling, link semantics. target="_blank" auto-adds rel="noopener" so you don't have to remember.
Disabled anchors drop their href and set aria-disabled="true" + tabindex="-1" so the click does nothing and keyboard focus skips the button.
Theming
Every CSS variable above can be overridden on a parent or on the host element directly. The kit ships five named theme presets (light, dark, bootstrap, tailwind, material, shadcn) that re-skin the button without any per-component tweaking.
Accessibility
- Buttons render as native
<button type="button">and inherit all the default keyboard / focus behavior. - Anchors get
role="button"plus the same visual:focus-visiblering. Disabled anchors are not focusable. - Pass an icon-only button an
aria-labelso screen readers have something to announce. The default slot is opaque to assistive tech.