Repo

Usage

<input class="zui-input" type="text" placeholder="Enter your name" />

Input Types

<input class="zui-input" type="text" placeholder="Text" />
<input class="zui-input" type="email" placeholder="Email" />
<input class="zui-input" type="password" placeholder="Password" />
<input class="zui-input" type="number" placeholder="Number" />
<input class="zui-input" type="search" placeholder="Search" />
<input class="zui-input" type="url" placeholder="URL" />

With Label

<div class="zui-field">
<label class="zui-label" for="name">Full name</label>
<input class="zui-input" type="text" id="name" placeholder="Jane Doe" />
</div>

Invalid State

<input class="zui-input" type="email" value="not-an-email" aria-invalid="true" />

Disabled

<input class="zui-input" type="text" value="Cannot edit" disabled />

Shape

Use the shape prop to change the corners. It works the same as on Button: default (rounded), hard (square), soft (pill) and squircle.

A squircle is a rounded square with smooth corners. Browsers without corner-shape support show normal rounded corners. To make squircle the default everywhere, see Squircle.

<div class="zui-field">
<label class="zui-label" for="default-input">Default (rounded)</label>
<input class="zui-input" type="text" id="default-input" placeholder="Type here" />
</div>
<div class="zui-field">
<label class="zui-label" for="hard-input">Hard</label>
<input class="zui-input zui-input-shape-hard" type="text" id="hard-input" placeholder="Type here" />
</div>
<div class="zui-field">
<label class="zui-label" for="soft-input">Soft</label>
<input class="zui-input zui-input-shape-soft" type="text" id="soft-input" placeholder="Type here" />
</div>
<div class="zui-field">
<label class="zui-label" for="squircle-input">Squircle</label>
<input class="zui-input zui-input-shape-squircle" type="text" id="squircle-input" placeholder="Type here" />
</div>

CSS custom properties

Set these on :root, on a wrapper, or on the element. See Component custom properties.

Property Default Description
--zui-input-radius var(--radius-lg) Border radius
--zui-input-border var(--color-border) Border colour
--zui-input-bg var(--color-background) Background colour
--zui-input-fg var(--color-text) Text colour
--zui-input-padding-block var(--space-3xs) Vertical padding
--zui-input-padding-inline var(--space-xs) Horizontal padding
--zui-input-font-size var(--step-0) Font size
--zui-input-focus-border var(--color-theme) Border colour on focus

Theme

Copy this CSS to your project: