• This repository has been archived on 03/Aug/2020
  • Stars
    star
    173
  • Rank 220,124 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Spinner utility for Tailwind CSS

Tailwind CSS Spinner

Spinner utility for Tailwind CSS

NOTICE: This package is now deprecated and archived as Tailwind CSS v1.6 introduced animations with spinners in the examples. Please use that instead.

Installation

Add this plugin to your project:

# Install using pnpm
pnpm install --save-dev tailwindcss-spinner

# Install using npm
npm install --save-dev tailwindcss-spinner

# Install using yarn
yarn add -D tailwindcss-spinner

Usage

// tailwind.config.js
{
  theme: { // defaults to these values
    spinner: (theme) => ({
      default: {
        color: '#dae1e7', // color you want to make the spinner
        size: '1em', // size of the spinner (used for both width and height)
        border: '2px', // border-width of the spinner (shouldn't be bigger than half the spinner's size)
        speed: '500ms', // the speed at which the spinner should rotate
      },
      // md: {
      //   color: theme('colors.red.500', 'red'),
      //   size: '2em',
      //   border: '2px',
      //   speed: '500ms',
      // },
    }),
  },

  variants: { // all the following default to ['responsive']
    spinner: ['responsive'],
  },

  plugins: [
    // optional configuration for resulting class name and/or tailwind theme key
    require('tailwindcss-spinner')({ className: 'spinner', themeKey: 'spinner' }),
  ],
}

Resulting CSS:

.spinner {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.spinner::after {
  content: '';
  position: absolute !important;
  top: calc(50% - (1em / 2));
  left: calc(50% - (1em / 2));
  display: block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-radius: 9999px;
  border-right-color: transparent;
  border-top-color: transparent;
  animation: spinAround 500ms infinite linear;
}

@keyframes spinAround {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

Example

More Repositories

1

awesome-tailwindcss

😎 Awesome things related to Tailwind CSS
13,182
star
2

semantic-ui-sass

Semantic UI, converted to Sass.
CSS
50
star
3

saas-starter

The SaaS starter you need to get shit done
PHP
39
star
4

next-saas

Rapid development of SaaS products with Next.js
TypeScript
38
star
5

kubit

Full stack web framework for Node.js
TypeScript
26
star
6

tailwind-htmx

Variants for styling htmx classes with Tailwind CSS
TypeScript
18
star
7

react-provider-tree

Break out of provider tree hell
TypeScript
17
star
8

plebpack

Webpack configuration for the common people.
TypeScript
12
star
9

ui

Blade / Livewire UI Components
10
star
10

next-saas-starter

Groundwork template for starting SaaS applications on Next.js
TypeScript
8
star
11

groundwork

Scaffold out any project quickly
TypeScript
7
star
12

docker-images

Collection of base Docker images
Dockerfile
7
star
13

htmx-ext

Collection of useful htmx extensions
TypeScript
4
star
14

moleculer-service

TypeScript decorators for Moleculer services
TypeScript
3
star
15

makerlog

Makerlog Node.js API Client
TypeScript
3
star
16

you-might-not-need-graphql

Spoiler: You do.
HTML
3
star
17

tsconfig

Shared TypeScript config for NiftyCo projects
3
star
18

prettier

Standardized code formatting via Prettier config for NiftyCo projects
TypeScript
3
star
19

workspace-scripts

CLI scripts to help manage things in NiftyCo workspaces
TypeScript
2
star
20

eslint-config-nifty

ESLint shareable config for NiftyCo projects
TypeScript
2
star
21

staticbrew

Where your static sites live
TypeScript
1
star
22

mailerlite

Node module for MailerLite HTTP API v2
TypeScript
1
star
23

bookshelf-facade

Modern JavaScript wrapping Bookshelf Models
TypeScript
1
star
24

npm-package

Groundwork template for packages published on npm.
TypeScript
1
star
25

laravel-attachments

Turn any field on your Eloquent models into attachments
PHP
1
star
26

laranew

The Laravel template installer.
PHP
1
star
27

laravel

Custom Laravel skeleton for NiftyCo applications
PHP
1
star
28

process-env

dotenv file loading
TypeScript
1
star
29

inkwell

Your story, your canvas
PHP
1
star
30

vendorizer

Link Packagist packages assets to node_modules
1
star
31

vite-plugin-maizzle

Vite plugin for Maizzle
HTML
1
star
32

im-an-adult

It's okay, I'm an adult.
TypeScript
1
star