Input 23

PreviousNext

An email input field with an overlapping label positioned over the border

Docs
shadcn-studiocomponent

Preview

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

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

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

  return (
    <div className='group relative w-full max-w-xs'>
      <Label
        htmlFor={id}
        className='bg-background text-foreground absolute top-0 left-2 z-1 block -translate-y-1/2 px-1 text-xs'
      >
        Input with overlapping label
      </Label>
      <Input id={id} type='email' placeholder='Email address' className='dark:bg-background h-10' />
    </div>
  )
}

export default InputOverlappingLabelDemo

Installation

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

Usage

import { Input23 } from "@/components/input-23"
<Input23 />