A plugin that provides a basic reset for form styles that makes form elements easy to override with utilities.
Installations
npm install @tailwindcss/forms
Score
98.4
Supply Chain
98.5
Quality
90.2
Maintenance
100
Vulnerability
100
License
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
22.8.0
NPM Version
10.8.2
Statistics
4,263 Stars
152 Commits
225 Forks
32 Watching
2 Branches
21 Contributors
Updated on 26 Nov 2024
Bundle Size
10.30 kB
Minified
2.89 kB
Minified + Gzipped
Languages
HTML (57.82%)
JavaScript (42.18%)
Total Downloads
Cumulative downloads
Total Downloads
155,204,870
Last day
-2.4%
308,927
Compared to previous day
Last week
3.2%
1,658,501
Compared to previous week
Last month
8.1%
6,933,164
Compared to previous month
Last year
49.7%
71,234,053
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Peer Dependencies
1
Dev Dependencies
5
@tailwindcss/forms
A plugin that provides a basic reset for form styles that makes form elements easy to override with utilities.
Installation
Install the plugin from npm:
1npm install -D @tailwindcss/forms
Then add the plugin to your tailwind.config.js
file:
1// tailwind.config.js 2module.exports = { 3 theme: { 4 // ... 5 }, 6 plugins: [ 7 require('@tailwindcss/forms'), 8 // ... 9 ], 10}
Basic usage
All of the basic form elements you use will now have some simple default styles that are easy to override with utilities.
Currently we add basic utility-friendly form styles for the following form element types:
input[type='text']
input[type='password']
input[type='email']
input[type='number']
input[type='url']
input[type='date']
input[type='datetime-local']
input[type='month']
input[type='week']
input[type='time']
input[type='search']
input[type='tel']
input[type='checkbox']
input[type='radio']
select
select[multiple]
textarea
Every element has been normalized/reset to a simple visually consistent style that is easy to customize with utilities, even elements like <select>
or <input type="checkbox">
that normally need to be reset with appearance: none
and customized using custom CSS:
1<!-- You can actually customize padding on a select element now: --> 2<select class="rounded-full px-4 py-3"> 3 <!-- ... --> 4</select> 5 6<!-- Or change a checkbox color using text color utilities: --> 7<input type="checkbox" class="rounded text-pink-500" />
More customization examples and best practices coming soon.
Using classes to style
In addition to the global styles, we also generate a set of corresponding classes which can be used to explicitly apply the form styles to an element. This can be useful in situations where you need to make a non-form element, such as a <div>
, look like a form element.
1<input type="email" class="form-input rounded-full px-4 py-3" /> 2 3<select class="form-select rounded-full px-4 py-3"> 4 <!-- ... --> 5</select> 6 7<input type="checkbox" class="form-checkbox rounded text-pink-500" />
Here is a complete table of the provided form-*
classes for reference:
Base | Class |
---|---|
[type='text'] | form-input |
[type='email'] | form-input |
[type='url'] | form-input |
[type='password'] | form-input |
[type='number'] | form-input |
[type='date'] | form-input |
[type='datetime-local'] | form-input |
[type='month'] | form-input |
[type='search'] | form-input |
[type='tel'] | form-input |
[type='time'] | form-input |
[type='week'] | form-input |
textarea | form-textarea |
select | form-select |
select[multiple] | form-multiselect |
[type='checkbox'] | form-checkbox |
[type='radio'] | form-radio |
Using only global styles or only classes
Although we recommend thinking of this plugin as a "form reset" rather than a collection of form component styles, in some cases our default approach may be too heavy-handed, especially when integrating this plugin into existing projects.
If generating both the global (base) styles and classes doesn't work well with your project, you can use the strategy
option to limit the plugin to just one of these approaches.
1// tailwind.config.js 2plugins: [ 3 require("@tailwindcss/forms")({ 4 strategy: 'base', // only generate global styles 5 strategy: 'class', // only generate classes 6 }), 7],
When using the base
strategy, form elements are styled globally, and no form-{name}
classes are generated.
When using the class
strategy, form elements are not styled globally, and instead must be styled using the generated form-{name}
classes.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
11 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10
Reason
GitHub workflow tokens follow principle of least privilege
Details
- Warn: jobLevel 'contents' permission set to 'write': .github/workflows/prepare-release.yml:15
- Info: topLevel 'contents' permission set to 'read': .github/workflows/prepare-release.yml:10
- Info: topLevel 'contents' permission set to 'read': .github/workflows/release-insiders.yml:8
- Info: topLevel 'contents' permission set to 'read': .github/workflows/release.yml:8
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
packaging workflow detected
Details
- Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release-insiders.yml:12
Reason
3 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
Reason
Found 7/30 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/prepare-release.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-forms/prepare-release.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/prepare-release.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-forms/prepare-release.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/prepare-release.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-forms/prepare-release.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-insiders.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-forms/release-insiders.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-insiders.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-forms/release-insiders.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-forms/release.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-forms/release.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/prepare-release.yml:35
- Warn: npmCommand not pinned by hash: .github/workflows/release-insiders.yml:31
- Warn: npmCommand not pinned by hash: .github/workflows/release.yml:31
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 0 out of 3 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 10 are checked with a SAST tool
Score
5.5
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to @tailwindcss/forms
@julr/unocss-preset-forms
📋 Port of @tailwindcss/forms for UnoCSS.
@tailwindcss/custom-forms
A better base for styling form elements with Tailwind CSS.
react-tailwindcss-datepicker
A modern React Datepicker using Tailwind CSS 3
tailwindcss
A utility-first CSS framework for rapidly building custom user interfaces.