Giter VIP home page Giter VIP logo

Comments (4)

Mokshit06 avatar Mokshit06 commented on August 27, 2024 1

Macaron is missing some docs for styles, but since it extends the API of vanilla-extract you can check out their docs for recipes here https://vanilla-extract.style/documentation/packages/recipes/#recipe. recipe returns a function which you can call with variant values, for eg button({ color: "dark" }) would return the class names for this variant group. This is the same as the class produced by <Button color="dark" />

It is exported by macaron though, so you can just do

import { recipe } from '@macaron-css/core';

from macaron.

Mokshit06 avatar Mokshit06 commented on August 27, 2024

I honestly don't see a great reason to add this. Polymorphic types like this make Typescript quite a lot slower and also are harder to ensure the correctness of. If you see yourself often using the as prop, maybe convert the styled("button", styles) to recipe(styles) and use it as <WhateverComponent className={buttonStyle(...)} />?

from macaron.

dugip avatar dugip commented on August 27, 2024

@Mokshit06 If there's an alternative way that you propose on doing this, I'm all good for it 👍. That said, I can't find any docs on recipe.

from macaron.

dugip avatar dugip commented on August 27, 2024

Thanks, that helps 😄

from macaron.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.