Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwind integration #28

Open
Kelin2025 opened this issue Aug 5, 2022 · 3 comments
Open

Tailwind integration #28

Kelin2025 opened this issue Aug 5, 2022 · 3 comments
Labels
enhancement New feature or request RFC

Comments

@Kelin2025
Copy link

Would be also cool to see tw utility

import { tw } from 'foliage-tailwind'
import { component } from 'foliage-react'

const Button = component("button", {
  defaults: { size: "normal" },
  variants: {
    size: {
      large: tw`px-4 py-2`,
      normal: tw`px-2 py-1`
    }
  }
})
@Kelin2025 Kelin2025 added the enhancement New feature or request label Aug 5, 2022
@sergeysova sergeysova added RFC enhancement New feature or request and removed enhancement New feature or request labels Aug 5, 2022
@Kelin2025
Copy link
Author

We might have other integrations in the future, so I think it's better not to litter the core

@zarabotaet
Copy link

What this utility will do?

@sergeysova
Copy link
Member

Foliage is a build-time stylization library.
Allows switching style depending on props.

We can make tw utility that allows combining tailwind classes under the convenient name, but without using @apply because it is squashing tw-classes and enlarging bundle size.

const size = {
  large: tw`px-4 py-2`,
  small: tw`px-2 py-1`,
}

const Button = component('button', css``, {
  defaults: { size: 'large' },
  variants: { size },
})

const Icon = component('svg', css``, {
  default: { size: 'small' },
  variants: { size },
})
<Button size="small" />
// class="a8sduf-button px-2 py-1"

<Icon />
// class="dhgja7-icon px-2 py-1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request RFC
Projects
None yet
Development

No branches or pull requests

3 participants