āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/cosscom/coss/components/input-group ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
<ComponentPreview name="input-group-demo" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
npx shadcn@latest add @coss/input-group
</TabsPanel>
<TabsPanel value="manual">
<Steps>
<Step>Install the following dependencies:</Step>
npm install @base-ui-components/react
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="input-group" title="components/ui/input-group.tsx" /><Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsPanel> </CodeTabs>import { Input } from "@/components/ui/input"
import {
InputGroup,
InputGroupAddon,
InputGroupInput,
InputGroupText,
} from "@/components/ui/input-group"
<InputGroup>
<InputGroupInput type="email" placeholder="Email" />
<InputGroupAddon>
<MailIcon />
</InputGroupAddon>
</InputGroup>
<ComponentPreview name="input-group-with-end-icon" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-with-start-text" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-with-end-text" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-with-start-end-text" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-with-number-field" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-with-end-tooltip" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-with-icon-button" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-with-button" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-with-badge" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-with-kbd" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-with-inner-label" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-sm" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-lg" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-disabled" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-loading" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-64" />
<ComponentPreview name="input-group-textarea" className="[&_.preview>*]:w-full [&_.preview>*]:max-w-80" />
The main component that wraps inputs and addons.
| Prop | Type | Description |
| ----------- | ----------------------------- | ------------------------------------------------ |
| className | string | Additional CSS classes to apply to the component |
| ...props | React.ComponentProps<'div'> | All standard div attributes are supported |
A container for addons like icons, text, buttons, and other elements. Can be positioned at the start or end (inline), or top or bottom (block) of the input.
| Prop | Type | Default | Description |
| ----------- | ----------------------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| align | 'inline-start' \| 'inline-end' \| 'block-start' \| 'block-end' | 'inline-start' | The position of the addon relative to the input. Use inline-start or inline-end for inputs, and block-start or block-end for textareas |
| className | string | | Additional CSS classes to apply to the component |
| ...props | React.ComponentProps<'div'> | | All standard div attributes are supported |
A text container component for displaying text content within an InputGroupAddon. Automatically styles text with muted foreground color and handles icon sizing.
| Prop | Type | Description |
| ----------- | ------------------------------ | ------------------------------------------------ |
| className | string | Additional CSS classes to apply to the component |
| ...props | React.ComponentProps<'span'> | All standard span attributes are supported |
A specialized input component for use within InputGroup. It's essentially an unstyled Input component that inherits styling from the parent InputGroup.
| Prop | Type | Description |
| ----------- | ------------ | ----------------------------------------------------------------------------------------------------- |
| className | string | Additional CSS classes to apply to the component |
| ...props | InputProps | All props from the Input component are supported, including type, placeholder, disabled, etc. |
A specialized textarea component for use within InputGroup. It's essentially an unstyled Textarea component that inherits styling from the parent InputGroup.
| Prop | Type | Description |
| ----------- | --------------- | -------------------------------------------------------------------------------------------------------- |
| className | string | Additional CSS classes to apply to the component |
| ...props | TextareaProps | All props from the Textarea component are supported, including placeholder, disabled, rows, etc. |
If you're already familiar with shadcn/ui, this guide highlights the small differences and similarities so you can get started with coss ui quickly.
InputGroupButton component - use the regular Button component directly inside InputGroupAddon insteadInputGroupInput or InputGroupTextarea directly (and any Button inside it) - no need to add a data-disabled attribute on InputGroup.ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā