Button
Triggers an action. It’s a <button class="ts button …">, or an <a class="ts button …" href> when it needs to navigate. Comes with variants, sizes, shapes, states (disabled/loading), and icons.
Forms · TaishoDS Core, in plain HTML.
Examples
One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.
Primary action
Secondary action
Destructive action
Unavailable action
Class reference
Every value of each modifier, with its HTML ready to copy.
Size
Button height. lg (48 px) meets the touch target size; xs, sm, and md fall below it. xs (24 px) is the icon button that goes inside other components (clearing a field, closing a Tag).
Variant
Visual hierarchy: primary for the main action, secondary and tertiary for supporting ones, ghost with no background, and danger for destructive ones. With is-color-inherit, the button takes its container’s color.
Shape
Shape: default, pill, or square and circle for icon-only buttons.
Density
Inner spacing. compact tightens the height; comfortable loosens it.
States
disabled (the native attribute) blocks interaction and takes the button out of the tab order. loading (is-loading with aria-busy and aria-disabled; setButtonLoading sets them) keeps it focusable but not activatable, and adds “Loading” for screen readers.
Combinations
Several modifiers together, in real cases.
When to use
- Running an action, like submitting, saving, opening an overlay, or confirming.
- You need a hierarchy between actions (primary/secondary/ghost/danger).
- It’s a link that needs to look like a button. Write
<a class="ts button …" href>.
When not to use
- It’s only navigation in the middle of text →
link. - It’s an on/off that applies immediately →
toggle. - It’s several actions grouped behind a trigger →
menu.
Do
- One primary action per context; everything else is secondary.
- For an icon-only button, add
aria-labeland name the action in it. - On touch screens, use size
lg(48 px tall).smandmdfall below the recommended 48 × 48 minimum touch target.
Don’t
- Don’t use five primary buttons. None of them stands out anymore.
- Don’t use a button for navigation that reads like text →
link.
TaishoDS Core
Doesn’t need JavaScript—it’s markup and CSS.
It’s a native <button>. The browser handles focus, keyboard, and form submission. Core’s JS is optional and only covers the loading state. A button or link with aria-disabled="true" can’t be activated (not by click, Enter, or Space, and it doesn’t submit a form) even though it stays focusable, and setButtonLoading() sets the whole loading state at once, with the “Loading” text for screen readers in the page language.
| Attribute | What it does |
|---|---|
setButtonLoading(button, true | false) | Sets is-loading, aria-busy, aria-disabled, and the “Loading” text (the language comes from the page’s lang; setTexts changes it with buttonLoading). The button stays focusable but can’t be activated. When it ends, it removes all of it. |
aria-disabled="true" | On the button or link: it stays focusable but can’t be activated. disabled (on a <button>) also takes it out of the tab order. |
From the CDN, without a build, load taisho.button.css along with taisho.base.css. Also load:
taisho.spinner.css
For how Core works in general, see Behavior.
Accessibility
- Visible focus through
:focus-visible(the focus ring shows up only with the keyboard, not on a mouse click). - An
<a class="ts button" href>is a link. It has the link role (notrole="button"), navigates, and is activated with Enter, not Space. - With
setButtonLoading(button, true), the button carriesis-loading,aria-busy="true", andaria-disabled="true". It stays focusable but can’t be activated (not by click, Enter, or Space, and it doesn’t submit a form). The Spinner is decorative (aria-hidden), and a screen reader hears “Cargando” (or “Loading”) before the button’s text, depending on the page language. The class alone only changes the look: the text turns invisible but keeps its size, so the layout doesn’t jump. disabledalso appliesaria-disabledwhen it renders as an<a>(links have no nativedisabled).
Verification
What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.
- axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
- keyboard Adds no keys of its own—it uses the browser’s native behavior.
- screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.