npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@designbycode/tailwindcss-text-shadow

v2.2.1

Published

Tailwindcss utilities for text stroke

Downloads

1,779

Readme

Tailwind CSS Text Shadow Plugin

NPM

npm version npm NPM npm bundle size Test ts GitHub stars

The Tailwind CSS Text Shadow Plugin extends the default set of utility classes in Tailwind CSS to provide easy text shadow customization for your web projects. With this plugin, you can apply custom text shadows using utility classes or define your own text shadow variations based on predefined steps and color palettes.

TextShadow Plugin

📇 Table of Contents

Installation

To use this plugin, you need to have Tailwind CSS installed in your project. If you haven't installed Tailwind CSS yet, follow these steps:

Using pnpm

pnpm add @designbycode/tailwindcss-text-shadow

Using npm

npm install @designbycode/tailwindcss-text-shadow

Using yarn

yarn add @designbycode/tailwindcss-text-shadow

Setup

  1. Add the Plugin to your Tailwind CSS Config In your tailwind.config.js file, add the plugin to the plugins array:
module.exports = {
    // ...other configurations
    plugins: [
        // ...other plugins
        require("@designbycode/tailwindcss-text-shadow"),
    ],
}

Default configuration styles

  1. If the default styles do not suit your preferences, you can effortlessly customize them using the following configuration options
module.exports = {
    // ...other configurations
    require("@designbycode/tailwindcss-text-shadow"
)
({
    shadowColor: "rgba(0, 0, 0, 0.5)",
    shadowBlur: "3px",
    shadowOffsetX: "2px",
    shadowOffsetY: "2px",
})

Use

Video Tutorial

See plugin in action in video below. 👇

Tailwindcss text-shadow tutorial

Apply Text Shadows

Once the plugin is added to your Tailwind CSS configuration, you can use the provided utility classes to apply text shadows to your HTML elements.

<h1 class="text-4xl text-shadow ">Hello, Tailwind CSS!</h1>

Text shadow blur modifier

To make the spread or blur bigger add the .text-shadow-blur-{value}

<h1 class="text-4xl text-shadow text-shadow-blur-2 ">Hello, Tailwind CSS!</h1>

Text shadow x and y modifiers

The shadow can be moved on the xy axis using .text-shadow-x-{value} and .text-shadow-y-{value}

<h1 class="text-4xl text-shadow text-shadow-x-md text-shadow-y-lg text-shadow-blur-2 text-shadow-red">Hello, Tailwind CSS!</h1>

Text shadow color modifier

<h1 class="text-4xl text-shadow text-shadow-x-md text-shadow-y-lg text-shadow-blur-2 text-shadow-red-500">Hello, Tailwind CSS!</h1>

In the example above, the <h1> element will have a red text shadow with an x offset of 3px, a y offset of 4px, and a blur radius of 2px. The text-shadow class enables the text shadow styles, while the text-shadow-x-md, text-shadow-y-lg, and text-shadow-blur-2 classes customize the horizontal offset, vertical offset, and blur radius, respectively.

Text shadow color opacity

To change the opacity of the text-shadow-color use the following method

<h1 class="text-shadow text-shadow-red-500/10">Hello, Tailwind CSS!</h1>

<!-- with  arbitrary values -->

<h1 class="text-shadow text-shadow-red-[rgb(0,0,0,0.5)]">Hello, Tailwind CSS!</h1>

<!-- or arbitrary with / -->

<h1 class="text-shadow text-shadow-red-[gray]/20">Hello, Tailwind CSS!</h1>

Warning New experimental long shadow feature

module.exports = {
    // ...other configurations
    require("@designbycode/tailwindcss-text-shadow"
)
({
    experimental: true, // 👈 
})

Note the latest version doesn't need experimental anymore

Long text shadow

The long shadow is a new experimental feature that I add. It creates shadow that stacks to any amount. The classes is .text-shadow-sm or .text-shadow-[steps]

<h1 class="text-shadow-sm text-shadow-blur-2 text-shadow-red">Hello, Tailwind CSS!</h1>
<!-- or -->
<h1 class="text-shadow-[1000]">Hello, Tailwind CSS!</h1>

Tailwindcss text-shadow tutorial

Customization

You can customize the available text shadow options by modifying the theme.textShadowSteps property in your tailwind.config.js file. The steps defined in this object will be used to generate utility classes for each aspect of the text shadow.

Example

// tailwind.config.js
module.exports = {
    theme: {
        prefix: 'text-shadow',
        textShadowSteps: {
            sm: "1px",
            md: "2px",
            lg: "3px",
            xl: "4px",
            0: "0",
            1: "1px",
            2: "2px",
            3: "3px",
            4: "4px",
        },
    },
}

In this example, we have customized the textShadowSteps object with only four steps for sm, md, lg, and xl, and removed the rest. The plugin will generate utility classes accordingly.

Change class name prefix

If you don't like to use class name .text-shadow or are getting conflicts in application you can change it to whatever you want like .textShadow, ts or whatever you want. Change it in theme settings.

// tailwind.config.js
module.exports = {
    theme: {
        prefix: 'ts',
    },
}

Use

<div class="ts-lg ts-indigo-500"></div>

Contributing

Contributions to this plugin are welcome! If you encounter any issues, have feature requests, or want to improve the plugin, feel free to create a pull request or submit an issue on the GitHub repository.

Contributors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Acknowledgments

  • This plugin is inspired by the needs of web developers using Tailwind CSS.
  • Special thanks to the Tailwind CSS team for creating such an amazing framework.