Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Input with Description for Svelte

A Username field with a note above it that this will be the unique identifier on the platform, and the placeholder johndoe.

UI library: Ark UI

Username, then a line that this will be your unique identifier on the platform, then the field. The placeholder is johndoe. The note sits above the input.

Use it when people need the rule before they type. A note they only need while filling, such as a privacy line, can sit under the Field. In Svelte, Ark UI does not move that sentence.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Input anatomy: input, placeholder, value, caret

Usage

<Field class="w-full max-w-sm"><FieldLabel>Username</FieldLabel><FieldDescription>This will be your unique identifier on the platform.</FieldDescription><Input class="bg-background" placeholder="johndoe" type="text" /></Field>

FAQ

Why is the description above the input?

So it's read before typing. Put guidance that shapes the answer, such as what a username is for, above the field; put reassurance or format hints below it, as the Helper Text example does.

What is FieldDescription?

Muted, smaller text for a field's explanation. It tightens its spacing next to the label, so the label and the description read as one block above the input.

What kind of input is it?

A type text input with the placeholder johndoe, at the field's full width up to max-w-sm.

Do screen readers read the description?

They reach it in reading order, between the label and the input. To have it read when the input gets focus, give it an id and set aria-describedby on the input to it.

How long should a description be?

One short sentence. Longer guidance belongs in help text outside the field or in a tooltip.

How is Username tied to the field?

Clicking the label focuses the field, and screen readers announce it with the field. Field links FieldLabel to the input inside it, so there is no id to match.

API Reference

Field

No extra props in this demo. The rest is on the Field page.

Input

Sets placeholder="johndoe" and type="text". The rest is on the Input page.