Input 31

PreviousNext

An email input field with an inline send button positioned at the end

Docs
shadcn-studiocomponent

Preview

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

import { SendHorizonalIcon } from 'lucide-react'

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

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

  return (
    <div className='w-full max-w-xs space-y-2'>
      <Label htmlFor={id}>Input with end inline button</Label>
      <div className='relative'>
        <Input id={id} type='email' placeholder='Email address' className='pr-9' />
        <Button
          variant='ghost'
          size='icon'
          className='text-muted-foreground focus-visible:ring-ring/50 absolute inset-y-0 right-0 rounded-l-none hover:bg-transparent'
        >
          <SendHorizonalIcon />
          <span className='sr-only'>Subscribe</span>
        </Button>
      </div>
    </div>
  )
}

export default InputEndInlineButtonDemo

Installation

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

Usage

import { Input31 } from "@/components/input-31"
<Input31 />