Input 18

PreviousNext

A URL input field with both "https://" prefix and ".com" suffix text add-ons

Docs
shadcn-studiocomponent

Preview

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

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

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

  return (
    <div className='w-full max-w-xs space-y-2'>
      <Label htmlFor={id}>Input with text add-ons</Label>
      <div className='relative'>
        <Input id={id} type='text' placeholder='shadcnstudio' className='peer pr-13 pl-17' />
        <span className='pointer-events-none absolute inset-y-0 left-0 flex items-center justify-center pl-3 text-sm peer-disabled:opacity-50'>
          https://
        </span>
        <span className='pointer-events-none absolute inset-y-0 right-0 flex items-center justify-center pr-3 text-sm peer-disabled:opacity-50'>
          .com
        </span>
      </div>
    </div>
  )
}

export default InputTextAddOnsDemo

Installation

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

Usage

import { Input18 } from "@/components/input-18"
<Input18 />