Back to Shark UI

Input

docs/components/input

latest7.3 KB
Original Source

Sections

Components

Utilities

Forms

Hooks

Input

Copy Markdown

A field that allows users to enter text.

DocsAPI

PreviewCode

Installation#

CLIManual

pnpmbunnpmyarn

pnpm dlx shadcn@latest add @shark/input

Usage#

import { Input } from "@/components/ui/input";
<Input />

Controlled#

Control the value with value and onChange.

PreviewCode

Character count: 0

States#

Disabled#

Use the disabled prop to disable the input.

PreviewCode

Email

The field is currently disabled

Invalid#

Use the invalid prop to mark the input as invalid.

PreviewCode

Email

Please enter a valid email address

Sizes#

Use the size prop to change the input height.

Small#

PreviewCode

Medium#

PreviewCode

Large#

PreviewCode

Examples#

With Field#

Use Field components to create an input with a label and a description.

PreviewCode

Username

Choose a unique username for your account

Field Group#

Use FieldGroup to show multiple Field blocks and to build forms.

PreviewCode

Name

Email

We'll use this email to contact you

SubmitReset

File#

Use the type="file" prop to create a file input.

PreviewCode

Picture

Choose a picture for your profile

Dedicated File Upload component

For more advanced file upload functionality, use the FileUpload component instead.

Inline#

Use the orientation="horizontal" prop to create an inline input.

PreviewCode

Grid#

PreviewCode

First name

Last name

Address

Badge#

Use Badge in the label to highlight a recommended field.

PreviewCode

Webhook URLBeta

Input Group#

Use InputGroup to create an input group.

PreviewCode

Button Group#

Use ButtonGroup to create a button group.

PreviewCode

API Reference#

Input#

Text input. Accepts all native input attributes.

PropTypeDefault
size`"sm""md"
typestringtext
classNamestring-

For a complete list of props, see the Ark UI documentation.

[

Previous page

Input OTP ](/docs/components/input-otp)[

Next page

Item ](/docs/components/item)

On This Page

InstallationUsageControlledStatesDisabledInvalidSizesSmallMediumLargeExamplesWith FieldField GroupFileInlineGridBadgeInput GroupButton GroupAPI ReferenceInput