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

Component multi-part styling #2

Open
wrux opened this issue Mar 8, 2024 · 0 comments
Open

Component multi-part styling #2

wrux opened this issue Mar 8, 2024 · 0 comments

Comments

@wrux
Copy link
Owner

wrux commented Mar 8, 2024

Some components consist of multiple parts, so component styling should reflect that.

Possible usage:

{% set button = cvaMultiPart({
  base: 'block outline-none',
  icon: 'text-[1.5em]',
}, {
  variants: {
    display: {
      primary: {
        base: 'bg-blue-500 text-white',
      },
      secondary: {
        base: 'bg-purple-500 text-white',
        icon: 'opacity-50',
      },
    },
    size: {
      base: 'py-2 px-4 text-base',
      large: 'py-3 p-6 text-lg',
    },
  },
  defaultVariants: {
    display: 'primary',
    size: 'base',
  },
}) %}
{% set buttonStyle({ size: 'large' }) %}

<button class="{{ buttonStyle.button }}">
  <svg class="{{ buttonStyle.icon }}">
    <use xlink:href="#icon-check" />
  </svg>
  Click me
</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant