API Reference
csx
Integrations
Vanilla Extract

Vanilla Extract Integration

Integrates CSX with vanilla-extract (opens in a new tab).

Usage

Install the packages

npm i @vtex/shoreline-vanilla-extract @vanilla-extract/css

Configure vanilla-extract

Vanilla Extract is a built-time solution. This means that the configuration changes depending on the project structure. Check the docs and install the correct version for your app (opens in a new tab).

Write your styles

example.css.ts
import { csx } from '@vtex/shoreline-vanilla-extract'
 
export const example = csx({
  bg: '$bg-primary',
  fg: '$fg-primary',
})
example.tsx
import { example } from './example.css.ts'
 
function Example() {
  return <div className={example}>{/** ... */}</div>
}