Input 21

PreviousNext

A URL input field with both external "https://" and ".com" add-on boxes

Docs
shadcn-studiocomponent

Preview

Loading preview…
registry/new-york/components/input/input-21.tsx
import { useId } from 'react'

import { Input } from '@/registry/new-york/ui/input'
import { Label } from '@/registry/new-york/ui/label'

const InputAddOnsDemo = () => {
  const id = useId()

  return (
    <div className='w-full max-w-xs space-y-2'>
      <Label htmlFor={id}>Input with add-ons</Label>
      <div className='flex rounded-md shadow-xs'>
        <span className='border-input bg-background text-muted-foreground -z-1 inline-flex items-center rounded-l-md border px-3 text-sm'>
          https://
        </span>
        <Input id={id} type='text' placeholder='shadcnstudio' className='-mx-px rounded-none shadow-none' />
        <span className='border-input bg-background text-muted-foreground -z-1 inline-flex items-center rounded-r-md border px-3 text-sm'>
          .com
        </span>
      </div>
    </div>
  )
}

export default InputAddOnsDemo

Installation

npx shadcn@latest add @shadcn-studio/input-21

Usage

import { Input21 } from "@/components/input-21"
<Input21 />