Input
A text field.
import { Input } from "@dapplelight/signet-ui/components/input"
export function Demo() {
return <Input className="max-w-sm" type="email" placeholder="[email protected]" aria-label="Email" />
}Installation
npm i @dapplelight/signet-uiUsage
import { Input } from "@dapplelight/signet-ui/components/input"
<Input type="email" placeholder="[email protected]" />Examples
With label
import { Input } from "@dapplelight/signet-ui/components/input"
import { Label } from "@dapplelight/signet-ui/components/label"
export function Demo() {
return (
<div className="grid w-full max-w-sm gap-2">
<Label htmlFor="invoice-ref">Reference</Label>
<Input id="invoice-ref" placeholder="PO-20931" />
</div>
)
}File
import { Input } from "@dapplelight/signet-ui/components/input"
import { Label } from "@dapplelight/signet-ui/components/label"
export function Demo() {
return (
<div className="grid w-full max-w-sm gap-2">
<Label htmlFor="receipt">Receipt</Label>
<Input id="receipt" type="file" />
</div>
)
}Disabled
import { Input } from "@dapplelight/signet-ui/components/input"
export function Demo() {
return <Input className="max-w-sm" disabled defaultValue="INV-1042" aria-label="Invoice number" />
}Invalid
import { Input } from "@dapplelight/signet-ui/components/input"
export function Demo() {
return <Input className="max-w-sm" aria-invalid defaultValue="12/31/26" aria-label="Due date" />
}Composition
import { Button } from "@dapplelight/signet-ui/components/button"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@dapplelight/signet-ui/components/card"
import { Input } from "@dapplelight/signet-ui/components/input"
import { Label } from "@dapplelight/signet-ui/components/label"
export function SignUpCard() {
return (
<Card>
<CardHeader>
<CardTitle>Create your account</CardTitle>
<CardDescription>Sign in with a magic link. No password.</CardDescription>
</CardHeader>
<CardContent className="grid gap-2">
<Label htmlFor="email">Email</Label>
<Input id="email" type="email" placeholder="[email protected]" />
</CardContent>
<CardFooter>
<Button className="w-full">Send magic link</Button>
</CardFooter>
</Card>
)
}API Reference
Input
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
type | string | "text" | No | Any HTML input type. |
aria-invalid | boolean | β | No | Shows the error style. |
className | string | β | No | Merged last. |
Plus every native <input> attribute.