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 Group

Add addons, buttons, and helper content to inputs.

12 results

Installation#

npx shadcn@latest add @rescript-shadcn/InputGroup

Usage#

<InputGroup>
  <InputGroup.Input placeholder="Search..." />
  <InputGroup.Addon>
    <Icons.Search />
  </InputGroup.Addon>
</InputGroup>

Align#

Use the align prop on InputGroupAddon to position the addon relative to the input.

For proper focus management, InputGroupAddon should always be placed after InputGroupInput or InputGroupTextarea in the DOM. Use the align prop to visually position the addon.

inline-start#

Use align=InlineStart to position the addon at the start of the input. This is the default.

Icon positioned at the start.

inline-end#

Use align=InlineEnd to position the addon at the end of the input.

Icon positioned at the end.

block-start#

Use align=BlockStart to position the addon above the input.

Full Name

Header positioned above the input.

script.js

Header positioned above the textarea.

block-end#

Use align=BlockEnd to position the addon below the input.

USD

Footer positioned below the input.

0/280

Footer positioned below the textarea.

Examples#

Icon#

Text#

$
USD
https://
.com
@company.com
120 characters left

Button#

Kbd#

⌘K

Dropdown#

Spinner#

Saving...
Please wait...

Textarea#

Line 1, Column 1
script.js

Custom Input#

Add the data-slot="input-group-control" attribute to your custom input for automatic focus state handling.

Here's an example of a custom resizable textarea from a third-party library.

API Reference#

InputGroup#

The main component that wraps inputs and addons.

PropTypeDefault
classNamestring
<InputGroup>
  <InputGroupInput />
  <InputGroupAddon />
</InputGroup>

InputGroupAddon#

Displays icons, text, buttons, or other content alongside inputs.

Focus Navigation

For proper focus navigation, the InputGroupAddon component should be placed after the input. Set the align prop to position the addon.

PropTypeDefault
alignInlineStart | InlineEnd | BlockStart | BlockEndInlineStart
classNamestring
<InputGroupAddon align=InlineEnd>
  <SearchIcon />
</InputGroupAddon>

For <InputGroupInput />, use the InlineStart or InlineEnd alignment. For <InputGroupTextarea />, use the BlockStart or BlockEnd alignment.

The InputGroupAddon component can have multiple InputGroupButton components and icons.

<InputGroupAddon>
  <InputGroupButton> {"Button"->React.string} </InputGroupButton>
  <InputGroupButton> {"Button"->React.string} </InputGroupButton>
</InputGroupAddon>

InputGroupButton#

Displays buttons within input groups.

PropTypeDefault
sizeXs | IconXs | Sm | IconSm"xs"
variantDefault | Destructive | Outline | Secondary | Ghost | LinkGhost
classNamestring
<InputGroupButton> {"Button"->React.string} </InputGroupButton>
<InputGroupButton size=IconXs ariaLabel="Copy">
  <CopyIcon />
</InputGroupButton>

InputGroupInput#

Replacement for <Input /> when building input groups. This component has the input group styles pre-applied and uses the unified data-slot="input-group-control" for focus state handling.

PropTypeDefault
classNamestring

All other props are passed through to the underlying <Input /> component.

<InputGroup>
  <InputGroupInput placeholder="Enter text..." />
  <InputGroupAddon>
    <SearchIcon />
  </InputGroupAddon>
</InputGroup>

InputGroupTextarea#

Replacement for <Textarea /> when building input groups. This component has the textarea group styles pre-applied and uses the unified data-slot="input-group-control" for focus state handling.

PropTypeDefault
classNamestring

All other props are passed through to the underlying <Textarea /> component.

<InputGroup>
  <InputGroupTextarea placeholder="Enter message..." />
  <InputGroupAddon align=BlockEnd>
    <InputGroupButton> {"Send"->React.string} </InputGroupButton>
  </InputGroupAddon>
</InputGroup>
@@directive("'use client'")

@react.component
@@directive("'use client'")

@react.component
@@directive("'use client'")

@react.component
@react.component
let make = () =>
  <InputGroup className="max-w-xs">
@react.component
let make = () =>
  <Field className="max-w-sm">
@react.component
let make = () =>
  <Field className="max-w-sm">
@react.component
let make = () =>
  <Field.Group className="max-w-sm">
@react.component
let make = () =>
  <Field.Group className="max-w-sm">
@react.component
let make = () =>
  <div className="grid w-full max-w-sm gap-6">
@react.component
let make = () =>
  <div className="grid w-full max-w-sm gap-6">
@react.component
let make = () =>
  <InputGroup className="max-w-sm">
@react.component
let make = () =>
  <div className="grid w-full max-w-sm gap-4">
@react.component
let make = () =>
  <div className="grid w-full max-w-md gap-4">