Forms
TailwindProvides theme styling to forms when paired with the Tailwind forms plugin.
Stylesheets
Package
Source
Docs
Dependencies
Examples
We've provided a "kitchen sink" page to preview form elements.
Usage
Tailwind Forms Plugin
Follow the steps below to instlal this plugin. If you would like to learn more about this plugin, see Tailwind's YouTube tutorial.
npm install -D @tailwindcss/forms
Add the plugin to your
tailwind.config.cjs
module.exports = {
// ...
plugins: [
// Insert before the Skeleton Tailwind plugin:
require('@tailwindcss/forms'),
// ...
],
}
Usage
Create form elements using native HTML markup. We recommend span tags for label text.
<label for="name">
<span>Name</span>
<input type="text" id="name" bind:value={name} minlength="2" required>
</label>
<label for="color">
<span>Color</span>
<select name="color" id="color" bind:value={color}>
<option value="red">red</option>
<option value="green">green</option>
<option value="blue">blue</option>
</select>
</label>