Input
Native text input with Field integration and invalid state attributes.
Input renders a native input with Akaza state attributes and Field integration.
It preserves native text editing, validation, and form behavior.
Anatomy
ui.root: Native<input>element. Directclassalso applies here.
Input has one structural part and does not wrap the native element.
Usage
Value: Akaza
Examples
Field integration
Inside Field, the input inherits id, name, required, disabled, invalid state, and aria-describedby.
import './main.css'
Native validation
Use native input attributes when browser validation already covers the rule. Native invalid attributes are revealed after user input, blur, or a browser invalid event, so a required empty input does not render as invalid on page load. The explicit invalid prop still marks the input invalid immediately.
<template>
<Accordion
:items="items"
type="multiple"
/>
</template>
Cancel a value change
Use details.cancel() to reject a model update before it lands.
<Dialog
:ui="{
overlay: 'fixed inset-0 bg-black/50',
content: 'fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-lg bg-white p-6',
}"
/>
Disabled and readonly
Use disabled for unavailable fields and readonly for values users can copy but not edit.
/* Target by semantic class */
.akaza-dialog-overlay { background: rgba(0, 0, 0, 0.5); }
.akaza-dialog-content { border-radius: 12px; }
/* Target by state */
[data-akaza-state="open"] { opacity: 1; }
[data-akaza-state="checked"] { background: black; }
/* Target by positioning side */
.akaza-tooltip-content[data-akaza-side="top"] { margin-bottom: 8px; }
State styling
Use data attributes in ui.root for focused, invalid, dirty, and filled states.
@layer akaza-reset;
@import "tailwindcss";
@import "akaza-ui/dist/akaza-ui.css";
Canceled edits and reset
Calling details.cancel() in value-change restores the accepted native input value as well as suppressing the model update. Rejected text is not left in FormData. Native reset restores the mount-time value and clears touched/invalid state only when the reset event is not canceled.
API Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | — | Input id. Inherited from Field when omitted. |
name | string | — | Form field name. Inherited from Field when omitted. |
type | InputType | "text" | Native input type for text-like inputs. |
placeholder | string | — | Placeholder text. |
autocomplete | string | — | Native autocomplete setting. |
inputmode | InputProps["inputmode"] | — | Native input mode hint. |
minlength | number | — | Native minimum text length. |
maxlength | number | — | Native maximum text length. |
pattern | string | — | Native validation pattern. |
required | boolean | false | Required state. |
disabled | boolean | false | Disabled state. |
readonly | boolean | false | Read-only state. |
invalid | boolean | false | Sets aria-invalid and data-akaza-invalid. |
ariaLabel | string | — | Accessible label when no visible label exists. |
ariaDescribedby | string | field description/error | Accessible description ids. |
ui | InputUi | — | Classes for the input element. |
Emits
| Event | Payload | Description |
|---|---|---|
value-change | (value, details) | Fired before model updates. details.cancel() prevents the update. |
UI Options
| Key | Description |
|---|---|
root | The native input element. |
State Attributes
Input sets data-valid, data-invalid, data-dirty, data-touched, data-filled, data-focused, and data-disabled, plus matching data-akaza-* attributes.
Native data-akaza-invalid appears after interaction or invalid submit. Controlled invalid state from the invalid prop or parent Field appears immediately.
Styling Hooks
| UI key | CSS class | Data attrs |
|---|---|---|
root | akaza-input | data-valid, data-invalid, data-dirty, data-touched, data-filled, data-focused, data-disabled, and matching data-akaza-* attrs |
Plain class also applies to the native input root. ui.root is the structured equivalent.
Keyboard
Input preserves native keyboard behavior for its type, inputmode, autocomplete, selection, clipboard, and form submission. Akaza does not replace browser text editing shortcuts. Enter submits an owning form when native HTML rules permit it.