DocsComponentsInput
Input
A text field.
1 file
<pb-ui.input type="email" placeholder="Email" class="max-w-sm" />Installation
pyblade-ui add input- Copy this file into your projectcomponents/ui/input.html
@props({'type': 'text'}) <input type="{{ type }}" data-slot="input" {{ attributes.cn( "flex h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30", "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50", "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", ) }} /> - Update the path to fit your project
The
componentsfolder is the one set inpyblade.toml.
Usage
The tag <pb-ui.input> is available in all your templates.
<pb-ui.input name="email" type="email" placeholder="Email" />Examples
With a label
<div class="grid w-full max-w-sm gap-2">
<pb-ui.label for="email">Email</pb-ui.label>
<pb-ui.input id="email" type="email" placeholder="you@example.com" />
</div>With a button
<div class="flex w-full max-w-sm gap-2">
<pb-ui.input type="email" placeholder="Email" />
<pb-ui.button>Subscribe</pb-ui.button>
</div>Disabled
<pb-ui.input placeholder="Disabled" disabled class="max-w-sm" />Props
| Prop | Default |
|---|---|
| type | 'text' |
Any other attribute (class, id, x-on:click, hx-post…) is passed to the root element; your Tailwind classes win over the component's.