ReScript Shadcn
Get started
  • Installation
Components
  • Accordion
  • Alert
  • AlertDialog
  • AspectRatio
  • Attachment
  • Avatar
  • Badge
  • Breadcrumb
  • Bubble
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • ContextMenu
  • DataTable
  • DatePicker
  • Dialog
  • Direction
  • Drawer
  • DropdownMenu
  • Empty
  • Field
  • HoverCard
  • Input
  • InputGroup
  • InputOtp
  • Item
  • Kbd
  • Label
  • Marker
  • Menubar
  • Message
  • MessageScroller
  • NativeSelect
  • NavigationMenu
  • Pagination
  • Popover
  • Progress
  • RadioGroup
  • Resizable
  • ScrollArea
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner
  • Spinner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toast
  • Toggle
  • ToggleGroup
  • Tooltip
  • Typography

Input

A text input component for forms and user data entry with built-in styling and accessibility features.

Your API key is encrypted and stored securely.

Installation#

npx shadcn@latest add @rescript-shadcn/Input

Usage#

<Input />

Examples#

Basic#

Field#

Use Field, FieldLabel, and FieldDescription to create an input with a label and description.

Choose a unique username for your account.

Field Group#

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

We'll send updates to this address.

Disabled#

Use the disabled prop to disable the input. To style the disabled state, add the data-disabled attribute to the Field component.

This field is currently disabled.

Invalid#

Use the aria-invalid prop to mark the input as invalid. To style the invalid state, add the data-invalid attribute to the Field component.

This field contains validation errors.

File#

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

Select a picture to upload.

Inline#

Use Field with orientation="horizontal" to create an inline input. Pair with Button to create a search input with a button.

Grid#

Use a grid layout to place multiple inputs side by side.

Required#

Use the required attribute to indicate required inputs.

This field must be filled out.

Badge#

Use Badge in the label to highlight a recommended field.

Input Group#

To add icons, text, or buttons inside an input, use the InputGroup component. See the Input Group component for more examples.

https://

Button Group#

To add buttons to an input, use the ButtonGroup component. See the Button Group component for more examples.

Form#

A full form example with multiple inputs, a select, and a button.

We'll never share your email with anyone.

@react.component
let make = () =>
  <Field>
@react.component
let make = () => <Input placeholder="Enter text" />
@react.component
let make = () =>
  <Field>
@react.component
let make = () =>
  <Field.Group>
@react.component
let make = () =>
  <Field dataDisabled={true}>
@react.component
let make = () =>
  <Field dataInvalid={true}>
@react.component
let make = () =>
  <Field>
@react.component
let make = () =>
  <Field orientation=Horizontal>
@react.component
let make = () =>
  <Field.Group className="grid max-w-sm grid-cols-2">
@react.component
let make = () =>
  <Field>
@react.component
let make = () =>
  <Field>
@react.component
let make = () =>
  <Field>
@react.component
let make = () =>
  <Field>
@react.component
let make = () => {
  let countries: array<BaseUi.Select.Item.t<string>> = [