Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
more examples
Oleg Isonen67099dd86c2c
diff --git a/packages/css-vars/README.md b/packages/css-vars/README.mdindex a38dc09433..2f00bbfa34 100644--- a/packages/css-vars/README.md+++ b/packages/css-vars/README.md@@ -2,7 +2,7 @@This package helps you create uniquely named css variables as well as use them.-## Example+## API```tsimport { cssVars } from "css-vars";@@ -11,3 +11,59 @@ const myVariable = cssVars.define("my-variable"); // --my-variable-0cssVars.use(myVariable, "fallback"); // var(--my-variable-0, fallback)```++## Example using `style` prop++```ts+import { cssVars } from "css-vars";++// icon.ts+const showVar = cssVars.define("button-show"); // --button-show-0++export const buttonCssVars = ({ show }: { show: boolean }) => ({+ [showVar]: show ? "block" : "none",+});++export const Button = () => {+ return <button style={{display: cssVars.use(showVar, "none")}}></button>+}++// panel.ts+import {Button, buttonCssVars} from './button'++const Panel = (props) => {+ const [show, setShow] = useState(false)++ return (+ <div {...props} style={buttonCssVars({show})} >+ <Button />+ </div>+ )+}+```++## Example using stitches with `:hover`++```ts+import { cssVars } from "css-vars";+import {styled} from 'stitches'++// icon.ts+const showVar = cssVars.define("button-show"); // --button-show-0++export const buttonCssVars = ({ show }: { show: boolean }) => ({+ [showVar]: show ? "block" : "none",+});++export const Button = styled('button', {+ display: cssVars.use(showVar, "none")+})++// panel.ts+import {Button, buttonCssVars} from './button'+import {styled} from 'stitches'++const Panel = styled('div', {+ '&:hover': buttonCssVars({show: true})+})+```