Skip to content

Implementing capitalize-first #1745

Answered by simonswiss
matschik asked this question in Help
May 10, 2020 · 10 comments · 16 replies
Discussion options

You must be logged in to vote

Here's a Tailwind Play example how you could integrate this as a plugin.

In this specific scenario, I have enabled responsive and hover variants for it, and made an example for all three in the HTML.

https://play.tailwindcss.com/6Fz3f8mHpO?file=config

I'll copy the code here as well for reference:

// Tailwind config
const plugin = require('tailwindcss/plugin')

// Let's create a plugin that adds utilities!
const capitalizeFirst = plugin(function ({ addUtilities }) {
  const newUtilities = {
    '.capitalize-first:first-letter': {
      textTransform: 'uppercase',
    },
  }
  addUtilities(newUtilities, ['responsive', 'hover'])
})

module.exports = {
  theme: {},
  variants: {},
  // Let's…

Replies: 10 comments 16 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@matschik
Comment options

@simonswiss
Comment options

Comment options

You must be logged in to vote
3 replies
@diegoulloao
Comment options

@ripern
Comment options

@riderx
Comment options

Answer selected by simonswiss
Comment options

You must be logged in to vote
2 replies
@ddahan
Comment options

@royvanv
Comment options

Comment options

You must be logged in to vote
1 reply
@Gib-git
Comment options

Comment options

You must be logged in to vote
8 replies
@mahendraAtMave
Comment options

@wongjn
Comment options

@mahendraAtMave
Comment options

@sinashahoveisi
Comment options

@mahendraAtMave
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
Converted from issue

This discussion was converted from issue #1745 on August 24, 2020 05:19.