shadcn-remix
GitHub

Input

A text input component for forms and user data entry with built-in styling and accessibility features.

import { Input } from '#app/ui/input.tsx'

export function InputDemo() {
  return () => <Input type="email" placeholder="Email" />
}
import { Input } from '#app/ui/input.tsx'

export function InputDemo() {
  return () => <Input type="email" placeholder="Email" />
}

Installation

$ pnpm dlx shadcn@latest add https://www.shadcn-remix.com/r/input.json

Usage

import { Input } from '#app/ui/input.tsx'
<Input />

Examples

Disabled

Use the disabled prop to disable the input. To style the disabled state, add the data-disabled attribute to the Field component.

import { Input } from '#app/ui/input.tsx'

export function InputDisabled() {
  return () => <Input disabled type="email" placeholder="Email" />
}
import { Input } from '#app/ui/input.tsx'

export function InputDisabled() {
  return () => <Input disabled type="email" placeholder="Email" />
}

File

Use the type="file" prop to create a file input.

import { css } from 'remix/component'

import { Input } from '#app/ui/input.tsx'
import { Label } from '#app/ui/label.tsx'

const gridStyles = css({
import { css } from 'remix/component'

import { Input } from '#app/ui/input.tsx'
import { Label } from '#app/ui/label.tsx'

const gridStyles = css({
  display: 'grid',
  width: '100%',
  maxWidth: '24rem',
  alignItems: 'center',
  gap: '0.75rem',
})

export function InputFile() {
  return () => (
    <div mix={gridStyles}>
      <Label htmlFor="picture">Picture</Label>
      <Input id="picture" type="file" />
    </div>
  )
}

With button

import { css } from 'remix/component'

import { Button } from '#app/ui/button.tsx'
import { Input } from '#app/ui/input.tsx'

const rowStyles = css({
import { css } from 'remix/component'

import { Button } from '#app/ui/button.tsx'
import { Input } from '#app/ui/input.tsx'

const rowStyles = css({
  display: 'flex',
  width: '100%',
  maxWidth: '24rem',
  alignItems: 'center',
  gap: '0.5rem',
})

export function InputWithButton() {
  return () => (
    <div mix={rowStyles}>
      <Input type="email" placeholder="Email" />
      <Button type="submit" variant="outline">
        Subscribe
      </Button>
    </div>
  )
}

With label

import { css } from 'remix/component'

import { Input } from '#app/ui/input.tsx'
import { Label } from '#app/ui/label.tsx'

const gridStyles = css({
import { css } from 'remix/component'

import { Input } from '#app/ui/input.tsx'
import { Label } from '#app/ui/label.tsx'

const gridStyles = css({
  display: 'grid',
  width: '100%',
  maxWidth: '24rem',
  alignItems: 'center',
  gap: '0.75rem',
})

export function InputWithLabel() {
  return () => (
    <div mix={gridStyles}>
      <Label htmlFor="email">Email</Label>
      <Input type="email" id="email" placeholder="Email" />
    </div>
  )
}

With text

Enter your email address.

import { css } from 'remix/component'

import { Input } from '#app/ui/input.tsx'
import { Label } from '#app/ui/label.tsx'

const gridStyles = css({
import { css } from 'remix/component'

import { Input } from '#app/ui/input.tsx'
import { Label } from '#app/ui/label.tsx'

const gridStyles = css({
  display: 'grid',
  width: '100%',
  maxWidth: '24rem',
  alignItems: 'center',
  gap: '0.75rem',
})
const mutedStyles = css({
  fontSize: '0.875rem',
  lineHeight: 'calc(1.25 / 0.875)',
  color: 'var(--muted-foreground)',
})

export function InputWithText() {
  return () => (
    <div mix={gridStyles}>
      <Label htmlFor="email-2">Email</Label>
      <Input type="email" id="email-2" placeholder="Email" />
      <p mix={mutedStyles}>Enter your email address.</p>
    </div>
  )
}

API Reference

Input

PropTypeDefault
mixMixValue-