InputGroup

InputGroup joins related fields and controls so they read as one input row.

import { PiMagnifyingGlass } from 'react-icons/pi'
import Button from '@/components/ui/button';
import Input from '@/components/ui/input';
import InputGroup from '@/components/ui/input-group';

Installation

Add this component with the NateUI CLI.

npx @nateui/cli@latest add InputGroup

Examples

Addons

import Input from '@/components/ui/input';
import InputGroup from '@/components/ui/input-group';

export default function AddonsDemo() {

With Buttons

import {
    PiMagnifyingGlass,
    PiMicrophone,
    PiPaperPlaneTilt,

Button Group

import { useState } from 'react';
import Button from '@/components/ui/button';
import InputGroup from '@/components/ui/input-group';

Size

import Button from '@/components/ui/button';
import Input from '@/components/ui/input';
import InputGroup from '@/components/ui/input-group';

Mixed Controls

import Button from '@/components/ui/button';
import Input from '@/components/ui/input';
import InputGroup from '@/components/ui/input-group';
import Select from '@/components/ui/select';

API

InputGroup is a compound component: InputGroup joins controls into one row and sizes the Addon, while InputGroup.Addon renders non-editable affix content. Set sizes on Button, Input, Select, or MultiValueInput directly.

InputGroup

InputGroup reads the props below and sizes the Addon.

PropDescriptionTypeDefault
childrenInputs, buttons, selects, addons, or compatible controls rendered as one joined row.ReactNode-
classNameClass names applied to the group root.string-
refRef forwarded to the group root element.Ref<HTMLDivElement>-
sizeControl size for the group, applied to the Addon.ControlSize'md'

InputGroup.Addon

Addon reads the props below and renders a non-editable segment inside an InputGroup.

PropDescriptionTypeDefault
childrenAddon content, such as a unit, symbol, domain suffix, or short label.ReactNode-
classNameClass names applied to the addon root.string-
refRef forwarded to the addon root element.Ref<HTMLDivElement>-
sizeControl size for the addon.ControlSize'md'

Types

type ControlSize = 'sm' | 'md' | 'lg';