shadcn-templ 2.0 beta. Switch to templUI v1
1.7k

Input

Displays a form input field or a component that looks like an input field.

Your API key is encrypted and stored securely.

package examples import (

Installation

shadcn-templ add input

Usage

import "github.com/axadrn/shadcn-templ/v2/components/input"
@input.Input()

Basic

package examples import "github.com/axadrn/shadcn-templ/v2/components/input"

Field

Use field.Field, field.Label, and field.Description to create an input with a label and description.

Choose a unique username for your account.

package examples import (

Field Group

Use field.Group to show multiple field.Field blocks and to build forms.

We'll send updates to this address.

package examples import (

Disabled

Use the Disabled prop to disable the input. To style the disabled state, set Disabled on the field.Field component.

This field is currently disabled.

package examples import (

Invalid

Use aria-invalid to mark the input as invalid. To style the invalid state, set Invalid on the field.Field component.

This field contains validation errors.

package examples import (

File

Use the Type: "file" prop to create a file input.

Select a picture to upload.

package examples import (

Inline

Use field.Field with Orientation: field.OrientationHorizontal to create an inline input. Pair with button.Button to create a search input with a button.

package examples import (

Grid

Use a grid layout to place multiple inputs side by side.

package examples import (

Required

Use the Required prop to indicate required inputs.

This field must be filled out.

package examples import (

Badge

Use Badge in the label to highlight a recommended field.

package examples import (

Input Group

To add icons, text, or buttons inside an input, use the InputGroup component. See the Input Group component for more examples.

https://
package examples import (

Button Group

To add buttons to an input, use the ButtonGroup component. See the Button Group component for more examples.

package examples import (

Form

A full form example with multiple inputs, a select, and a button.

We'll never share your email with anyone.

package examples import (

API Reference

Input

The Input component displays a native input element.

Prop Type Default
Type string ""
Name string -
Value string -
Placeholder string -
Disabled bool false
ReadOnly bool false
Required bool false
Accept string -
Form string -
Class string -