Input
A single-line text field. Supports a label, hint, error, prefixes and suffixes, a character counter, and a clear button (data-ts-clear).
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.
Field with label and placeholder
Email with hint
With error
With a leading icon
With a text prefix
Clearable
Loading
Search that waits until you stop typing
Class reference
Every value of each modifier, with its HTML ready to copy.
Size
Field height: sm, md, or lg.
Variant
The border color for validation: default, success, warning, info, or danger. variant-bare (not shown here) removes the box and the focus, for a field inside another component.
Density
The field’s inner spacing.
States
is-disabled blocks editing; is-readonly prevents it but keeps the field focusable and selectable; is-loading shows the Spinner without blocking anything.
Combinations
Size, variant, and density combined.
When to use
- Capturing short, single-line text, like a name, email, search query, or code.
- You need a prefix or suffix (a unit, an icon) or a clear button.
- Use
typeto switch to email, password, or tel and get the right system keyboard.
When not to use
- The text can be long or span several lines →
textarea. - It’s a number with limits and a step →
number-input. - It’s a date →
date-picker.
Do
- Build it with the
fieldmarkup for the label and messages. - Pick the right
type. It improves the mobile keyboard and validation.
Don’t
- Don’t use the placeholder as a label.
- Don’t use it to choose from a closed set →
select.
Related
TaishoDS Core
Needs Core’s JS, which hooks in through data-ts-* attributes.
It’s a native <input>, plus its own clear button.
Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.
data-ts-cleardata-ts-debouncedata-ts-field-spinnerdata-ts-input
What it does: Keeps the field in sync. On init, the caret of every field with a value moves to the end, so element.focus() from code doesn’t type before the existing text. Tab (which selects everything) and clicking work as usual.
| Attribute | What it does |
|---|---|
data-ts-field-spinner | The Spinner the example leaves hidden. setInputLoading(root, true | false) marks the field as busy (aria-busy) and shows it. It doesn’t block editing. |
data-ts-debounce="ms" | On the <input>. Core fires ts:debouncedinput (with detail.value) once the person stops typing. Clearing reports the empty value right away. |
data-ts-clear | A button that only shows when there’s content. Clicking it clears the field, fires input and change, and returns focus to the field. |
From the CDN, without a build, load taisho.input.css along with taisho.base.css. Also load:
taisho.button.csstaisho.icon.csstaisho.kbd.csstaisho.spinner.css
For how Core works in general, see Behavior.
Accessibility
- The
labelis associated with the input throughfor/id. Theidis written in the HTML and must be unique on the page. - The hint text (
ts input-hint) and the error message are linked to the field througharia-describedby. An invalid field carriesaria-invalid="true". - The clear button (
data-ts-clear) has its ownaria-label, written in the HTML. - The container’s
is-readonlyclass (together withreadonlyon the<input>) makes the background transparent and the cursordefault, with no visual escalation on hover. The field stays focusable and selectable, distinguishable from both an editable field and adisabledone. The clear button is always in the HTML, toggled withhiddendepending on whether there’s content.data-ts-cleartoggles it, and after clearing, focus returns to the field. is-loadingdoes NOT disable the field (unlike the button). The<input>stays editable.setInputLoading(root, true|false)setsis-loadingandaria-busy="true"while loading lasts. The class alone isn’t announced. The Spinner itself makes the announcement (role="status"with itsaria-label)—it isn’t duplicated with another live text. The Spinner sits next to “Clear field” ints input-actions.- With
element.focus()from code (for example, when a form opens), the caret lands at the end of the value, so what’s typed continues the text instead of being inserted before it. With Tab, the browser selects all the content. - With
data-ts-debounce, thets:debouncedinputevent waits until the person stops typing. It’s meant to triggeris-loadingandaria-busyonly then, without flooding the screen reader with a “Loading” on every keystroke. Theinputevent stays immediate.
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.