Docs
Input
Input
Displays a form input field or a component that looks like an input field.
Loading...
<script lang="ts">
import { Input } from "@/components/ui/input";
</script>
<Input type="email" placeholder="email" class="max-w-xs" />
<script lang="ts">
import { Input } from "@/components/ui/input";
</script>
<Input type="email" placeholder="email" class="max-w-xs" />
Installation
npx shadcn-svelte add input
Usage
<script lang="ts">
import { Input } from "$components/ui/input";
</script>
<Input />
Examples
Default
Loading...
<script lang="ts">
import { Input } from "@/components/ui/input";
</script>
<Input type="email" placeholder="email" class="max-w-xs" />
<script lang="ts">
import { Input } from "@/components/ui/input";
</script>
<Input type="email" placeholder="email" class="max-w-xs" />
Disabled
Loading...
<script lang="ts">
import { Input } from "@/components/ui/input";
</script>
<Input disabled type="email" placeholder="email" class="max-w-xs" />
<script lang="ts">
import { Input } from "@/components/ui/input";
</script>
<Input disabled type="email" placeholder="email" class="max-w-sm" />
With Label
Loading...
<script lang="ts">
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
</script>
<div class="grid w-full max-w-sm items-center gap-1.5">
<Label for="email">Email</Label>
<Input type="email" id="email" placeholder="email" />
</div>
<script lang="ts">
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
</script>
<div class="grid w-full max-w-sm items-center gap-1.5">
<Label for="email">Email</Label>
<Input type="email" id="email" placeholder="email" />
</div>
With Text
Loading...
<script lang="ts">
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
</script>
<div class="grid w-full max-w-sm items-center gap-1.5">
<Label for="email-2">Email</Label>
<Input type="email" id="email-2" placeholder="Email" />
<p class="text-sm text-muted-foreground">Enter your email address.</p>
</div>
<script lang="ts">
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
</script>
<div class="grid w-full max-w-sm items-center gap-1.5">
<Label for="email-2">Email</Label>
<Input type="email" id="email-2" placeholder="Email" />
<p class="text-sm text-muted-foreground">Enter your email address.</p>
</div>
With Button
Loading...
<script lang="ts">
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
</script>
<form class="flex w-full max-w-sm items-center space-x-2">
<Input type="email" placeholder="email" />
<Button type="submit">Subscribe</Button>
</form>
<script lang="ts">
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
</script>
<form class="flex w-full max-w-sm items-center space-x-2">
<Input type="email" placeholder="email" />
<Button type="submit">Subscribe</Button>
</form>
File
Loading...
<script lang="ts">
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
</script>
<div class="grid w-full max-w-sm items-center gap-1.5">
<Label for="picture">Picture</Label>
<Input id="picture" type="file" />
</div>
<script lang="ts">
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
</script>
<div class="grid w-full max-w-sm items-center gap-1.5">
<Label for="picture">Picture</Label>
<Input id="picture" type="file" />
</div>
On This Page