Input
A styled text input for forms.
Usage
<input class="zui-input" type="text" placeholder="Enter your name" /> import { Input } from '@mrmartineau/zui/react'
<Input type="text" placeholder="Enter your name" /> ---
import { Input } from '@mrmartineau/zui/astro'
---
<Input type="text" placeholder="Enter your name" /> import { Input } from '@mrmartineau/zui/solid'
<Input type="text" placeholder="Enter your name" /> <script lang="ts">
import { Input } from '@mrmartineau/zui/svelte'
let name = $state('')
</script>
<Input type="text" placeholder="Enter your name" bind:value={name} /> <template>
<Input type="text" placeholder="Enter your name" />
</template>
<script setup>
import { Input } from '@mrmartineau/zui/vue'
</script> 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" /> import { Input } from '@mrmartineau/zui/react'
<Input type="text" placeholder="Text" />
<Input type="email" placeholder="Email" />
<Input type="password" placeholder="Password" />
<Input type="number" placeholder="Number" />
<Input type="search" placeholder="Search" />
<Input type="url" placeholder="URL" /> ---
import { Input } from '@mrmartineau/zui/astro'
---
<Input type="text" placeholder="Text" />
<Input type="email" placeholder="Email" />
<Input type="password" placeholder="Password" />
<Input type="number" placeholder="Number" />
<Input type="search" placeholder="Search" />
<Input type="url" placeholder="URL" /> import { Input } from '@mrmartineau/zui/solid'
<Input type="text" placeholder="Text" />
<Input type="email" placeholder="Email" />
<Input type="password" placeholder="Password" />
<Input type="number" placeholder="Number" />
<Input type="search" placeholder="Search" />
<Input type="url" placeholder="URL" /> <script lang="ts">
import { Input } from '@mrmartineau/zui/svelte'
</script>
<Input type="text" placeholder="Text" />
<Input type="email" placeholder="Email" />
<Input type="password" placeholder="Password" />
<Input type="number" placeholder="Number" />
<Input type="search" placeholder="Search" />
<Input type="url" placeholder="URL" /> <template>
<Input type="text" placeholder="Text" />
<Input type="email" placeholder="Email" />
<Input type="password" placeholder="Password" />
<Input type="number" placeholder="Number" />
<Input type="search" placeholder="Search" />
<Input type="url" placeholder="URL" />
</template>
<script setup>
import { Input } from '@mrmartineau/zui/vue'
</script> With Label
<label class="zui-label" for="name">Full name</label>
<input class="zui-input" type="text" id="name" placeholder="Jane Doe" /> import { Label, Input } from '@mrmartineau/zui/react'
<Label htmlFor="name">Full name</Label>
<Input type="text" id="name" placeholder="Jane Doe" /> ---
import { Label, Input } from '@mrmartineau/zui/astro'
---
<Label for="name">Full name</Label>
<Input type="text" id="name" placeholder="Jane Doe" /> import { Label, Input } from '@mrmartineau/zui/solid'
<Label htmlFor="name">Full name</Label>
<Input type="text" id="name" placeholder="Jane Doe" /> <script lang="ts">
import { Label, Input } from '@mrmartineau/zui/svelte'
</script>
<Label for="name">Full name</Label>
<Input type="text" id="name" placeholder="Jane Doe" /> <template>
<Label for="name">Full name</Label>
<Input type="text" id="name" placeholder="Jane Doe" />
</template>
<script setup>
import { Label, Input } from '@mrmartineau/zui/vue'
</script> Invalid State
<input class="zui-input" type="email" value="not-an-email" aria-invalid="true" /> import { Input } from '@mrmartineau/zui/react'
<Input type="email" defaultValue="not-an-email" aria-invalid="true" /> ---
import { Input } from '@mrmartineau/zui/astro'
---
<Input type="email" value="not-an-email" aria-invalid="true" /> import { Input } from '@mrmartineau/zui/solid'
<Input type="email" defaultValue="not-an-email" aria-invalid="true" /> <script lang="ts">
import { Input } from '@mrmartineau/zui/svelte'
</script>
<Input type="email" value="not-an-email" aria-invalid="true" /> <template>
<Input type="email" value="not-an-email" aria-invalid="true" />
</template>
<script setup>
import { Input } from '@mrmartineau/zui/vue'
</script> Disabled
<input class="zui-input" type="text" value="Cannot edit" disabled /> import { Input } from '@mrmartineau/zui/react'
<Input type="text" defaultValue="Cannot edit" disabled /> ---
import { Input } from '@mrmartineau/zui/astro'
---
<Input type="text" value="Cannot edit" disabled /> import { Input } from '@mrmartineau/zui/solid'
<Input type="text" defaultValue="Cannot edit" disabled /> <script lang="ts">
import { Input } from '@mrmartineau/zui/svelte'
</script>
<Input type="text" value="Cannot edit" disabled /> <template>
<Input type="text" value="Cannot edit" disabled />
</template>
<script setup>
import { Input } from '@mrmartineau/zui/vue'
</script> CSS 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 |