All Projects → brunobertolini → tailed

brunobertolini / tailed

Licence: other
Tailed is a tiny lib to add styled-components syntax like, with suport to conditional classes.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to tailed

Styled Bootstrap
💅🏻 A styled-component implementation of Bootstrap
Stars: ✭ 154 (+94.94%)
Mutual labels:  styled-components, css-in-js
Styled Theme
Extensible theming system for styled-components 💅
Stars: ✭ 183 (+131.65%)
Mutual labels:  styled-components, css-in-js
Gatsby Theme Superstylin
💅 A Gatsby Theme with styled-components
Stars: ✭ 165 (+108.86%)
Mutual labels:  styled-components, css-in-js
React Next Boilerplate
🚀 A basis for reducing the configuration of your projects with nextJS, best development practices and popular libraries in the developer community.
Stars: ✭ 129 (+63.29%)
Mutual labels:  styled-components, css-in-js
Styled Ppx
Typed styled components in Reason, OCaml and ReScript
Stars: ✭ 236 (+198.73%)
Mutual labels:  styled-components, css-in-js
Next Dark Mode
🌑 Enable dark mode for Next.js apps
Stars: ✭ 133 (+68.35%)
Mutual labels:  styled-components, css-in-js
Grid
This package has moved and renamed
Stars: ✭ 2,079 (+2531.65%)
Mutual labels:  styled-components, css-in-js
Styled Typography
Typograpy components for react and styled-components
Stars: ✭ 113 (+43.04%)
Mutual labels:  styled-components, css-in-js
Styled Email Components
💌 styled-components for emails
Stars: ✭ 231 (+192.41%)
Mutual labels:  styled-components, css-in-js
Styled Components Vs Emotion
a short doc comparing the popular CSS-in-JS libraries styled-components and emotion
Stars: ✭ 204 (+158.23%)
Mutual labels:  styled-components, css-in-js
Scoped Style
A tiny css in js library 🚀
Stars: ✭ 129 (+63.29%)
Mutual labels:  styled-components, css-in-js
Styled Props
Simple lib that allows you to set styled props in your styled-components without stress.
Stars: ✭ 247 (+212.66%)
Mutual labels:  styled-components, css-in-js
Xstyled
A utility-first CSS-in-JS framework built for React. 💅👩‍🎤⚡️
Stars: ✭ 1,835 (+2222.78%)
Mutual labels:  styled-components, css-in-js
Goober
🥜 goober, a less than 1KB 🎉 css-in-js alternative with a familiar API
Stars: ✭ 2,317 (+2832.91%)
Mutual labels:  styled-components, css-in-js
Styled By
Simple and powerful lib to handle styled props in your components
Stars: ✭ 122 (+54.43%)
Mutual labels:  styled-components, css-in-js
Filbert Js
A lightweight(~1kb) css-in-js framework
Stars: ✭ 167 (+111.39%)
Mutual labels:  styled-components, css-in-js
Css In React
🍭 CSS in React - Learn the best CSS in JS frameworks by example
Stars: ✭ 101 (+27.85%)
Mutual labels:  styled-components, css-in-js
Nanostyled
A <1kB library for styling React components as if with CSS-in-JS, without CSS-in-JS
Stars: ✭ 104 (+31.65%)
Mutual labels:  styled-components, css-in-js
Css In Js
Autocomplete React Native / JS Styles and converting plain CSS to JS styles
Stars: ✭ 192 (+143.04%)
Mutual labels:  styled-components, css-in-js
Awesome Styled Components
A curated list of awesome styled-components resources 💅
Stars: ✭ 2,869 (+3531.65%)
Mutual labels:  styled-components, css-in-js

Tailed

Tailed is a tiny lib to add styled-components syntax like, with suport to conditional classes.

Motivation

It's was initally be created to work with tailwindcss and avoid class mess inside react components without need a build process, but it's can used with any framework (maybe I need split in two packages later).

Usage

Tailed works like styled-components, but, with class names instead of css props.

import { tailed } from 'tailed-js'

const Box = tailed('div')`
  bg-red
  p-2 lg:p-4
  rounded-sm lg:rounded-lg

  ${props => props?.size === 'small' && 'text-sm'}
`

// it's allow especialization
const ErrorBox = tailed(Box)`
  border-red
`

// and you can continue using className prop to add extra class names
const App = () => (
  <Box className="m-4">
    Magic!
  </Box>
)

Using "as" prop

Like styled-components, you can add as prop to use a diferent base component:

const Button = tailed('button')``

// In this case, the rendered element will be an <a> tag instead of <button>.
<Button as="a" />

// There, you get AnotherComponent rendered instead of <button> tag
<Button as={AnotherComponent}>

Using without React

You can use this lib with a more independent way, importing tail insteadof tailed.

import { tail } from `tailed-js`

const classNames = tail`
  bg-red
  p-2 lg:p-4
  rounded-sm lg:rounded-lg

  ${props => props?.size === 'small' && 'text-sm'}
`

const names = classNames({
  size: 'small'
})

It's totally independent of lib/frameowork and is a dependency free.

A bit more powerfull

Using tailed with styled-by, you can create a powerfull conditional styles handler.

import { tail } from 'tailed-js'
import styledBy from 'styled-by'

// you can use tail or tailed here
const classNames = tail`
  bg-red
  p-2 lg:p-4
  rounded-sm lg:rounded-lg

  ${styledBy('size', {
    sm: 'text-sm',
    lg: 'text-lg'
  })}
`

VS Code IntelliSense autocomplete

You can add these settings on your user config:

"editor.quickSuggestions": {
  "strings": true
},
"tailwindCSS.experimental.classRegex" : [
  "tailed`([^`]*)",
  "tailed\\(.*?\\)`([^`]*)",
  "tail`([^`]*)"
],
// if you're using typescript
"tailwindCSS.includeLanguages" : {
  "typescriptreact" : "javascript",
  "typescript" : "javascript"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].