@storefront-ui/tw-plugin-peer-next
TypeScript icon, indicating that this package has built-in type declarations

2.3.3 • Public • Published

Storefront UI

`peer-next` class for first next sibling.

GitHub Repository Stars Count Follow Us on Twitter Subscribe on our Youtube Channel Chat with us on Discord

npm Commitizen friendly License PRs Welcome


#TechForUkraine

Russia’s military aggression against Ukraine.

How can you support Ukrainian civil society?

All help is needed. If you are not able to help locally, by sheltering a fellow Ukrainian, you can also:

SF Typography

Extend of peer tailwind class but with + (first next sibling). Original peer class is for ~ (every following sibling).

Made with ❤️ by Alokai team and contributors.

Why?

Targeting next siblings with ~ is not suitable for HTML structure when pairing input and label, every label after changed input will also change. Of course we can wrap such groups but having in mind how browser works, nesting and making deeper HTML structure does affect performance of rendering HTML by browser.

Installation

npm install --save-dev @storefront-ui/tw-plugin-peer-next
// tailwind.config.ts

import sfPeerNext from '@storefront-ui/tw-plugin-peer-next';

export default {
  content: ['your-components-source-directory/*.ts'],
  plugins: [sfPeerNext]
};

How to use it

Plugin extends Tailwindcss peer class and allows to use it as an adjacent sibling combinator.

<form>
  <label class="block">
    <span class="block text-sm font-medium text-slate-700">Email</span>
    <input type="email" class="peer-next ..."/>
    <p class="invisible mt-2 text-sm text-pink-600 peer-next-invalid:visible">
      Please provide a valid email address.
    </p>
  </label>
</form>

Looking for a library to accelerate your ecommerce development?

Make sure to check out StorefrontUI! Read the documentation at https://docs.storefrontui.io/v2/ 🚀

Readme

Keywords

none

Package Sidebar

Install

npm i @storefront-ui/tw-plugin-peer-next

Weekly Downloads

2,237

Version

2.3.3

License

MIT

Unpacked Size

150 kB

Total Files

10

Last publish

Collaborators

  • mtokarskivsf
  • dzalewski
  • frsgit
  • aniamusial
  • filrak
  • adampawlinski