0.4.0 • Published 1 month ago

@tailwindcss/forms v0.4.0

Weekly downloads
78,868
License
MIT
Repository
github
Last release
1 month ago

@tailwindcss/forms

A plugin that provides a basic reset for form styles that makes form elements easy to override with utilities.

Installation

Note that @tailwindcss/forms is designed for Tailwind CSS v2.0.

Install the plugin from npm:

# Using npm
npm install @tailwindcss/forms

# Using Yarn
yarn add @tailwindcss/forms

Then add the plugin to your tailwind.config.js file:

// tailwind.config.js
module.exports = {
  theme: {
    // ...
  },
  plugins: [
    require('@tailwindcss/forms'),
    // ...
  ],
}

Usage

View the live demo

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

Note that for text inputs, you must add the type="text" attribute for these styles to take effect. This is a necessary trade-off to avoid relying on the overly greedy input selector and unintentionally styling elements we don't have solutions for yet, like input[type="range"] for example.

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:

<!-- You can actually customize padding on a select element now: -->
<select class="px-4 py-3 rounded-full">
  <!-- ... -->
</select>

<!-- Or change a checkbox color using text color utilities: -->
<input type="checkbox" class="rounded text-pink-500" />

More customization examples and best practices coming soon.

auctic-uireact-grid-dashboard-example-tsclasscard-ui-1billing-js-test-projectstatushero-blog@mayking0811/ui-components@joshpress/git-cmssmb-componentselsa-workflows-studio@turnslate/cmslb-agora-classroom-edu-sdk@anzi-credible/credible-common-uiholo-design-system-vue@space-designsystem/starter-kit-tailwind2pegadaian-components@fspo/design-systempongo-components-vue-test@win.com/ui@windmill/react-ui@zakodium/tailwind-config@xola/ui-kit@xtiannyeto/vue-auth-socialbankos-loan-form@prefix/studio-editor@monto/tailwindcssbetterseller-uialpha-ui-goappintercath-package2js-react-luxjumpstart-uiindebted-styleslevelupuijslib-vue-componentslui-testtttnpm-test-ahobytes-uinotus-jsnotus-nextjsnotus-reactnotus-sveltenotus-angularngerp-react-librecorder-rclreact-tailwind-jit-staterreact-tailwind-starterradixhr-clientpolux-styleqnireact-crisp-uipongo-components-vuepushgeek-web-push-servicesmmtransfermarketplace-toolbarmega3uiluxdmfx-component-librarysailuisegel-uisheldons-componentssheldons-componetnsreact-rondorm-web-componentsappkit-uiarcomagearcomage-hdcarrent-ke-uikitchat-websitedaihatsu-cfformdalenta-uicrossid-auth-widgetsfrontend-components-testing-abogadafreelancegatsby-theme-animated-tailwinddesy-frontenddesy-htmldominus-ecommdecanterdripformelm-default-tailwind-moduleselsa-2.0-designerelsa-workflow-designer-matdownloadsound.cloudempire-componentsclasscard-uicirro-designsystemhirehive-uiupvuevantage-uivite-react-tailwind-starter-ezizvue-auth-socialup-reactui-comp-libtw-css-extractortwinklecsstubular-react-tailwindtt-ui-comp-libuafrica-ui-frameworkslipstream-uisupertonesvelte-component-library-asimed
0.4.0-alpha.2

2 months ago

0.4.0

1 month ago

0.4.0-alpha.1

4 months ago

0.3.4

4 months ago

0.3.3

8 months ago

0.3.2

10 months ago

0.3.1

10 months ago

0.3.0

10 months ago

0.2.0-8a8671b

11 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago