Applying Styles
You can refer to the Foundations section to understand how is the tokens definition. You can use them in your app as CSS Variables which are defined in the theme, as mentioned in the Theme guide.
Importing CSS
Shoreline provides several CSS exports that you can import into your application. The simplest way is to import the complete stylesheet:
import '@vtex/shoreline/css'This imports all styles including tokens, reset, base, and components styles with cascade layers.
Individual Stylesheets
You can also import individual stylesheets for more granular control:
// Import complete stylesheet (layered)
import '@vtex/shoreline/css'
// Or unlayered version
import '@vtex/shoreline/css/unlayered'Available CSS Exports
| Export Path | Description | Layered | Unlayered |
|---|---|---|---|
@vtex/shoreline/css | Complete stylesheet (tokens + reset + base + components) | ✅ | @vtex/shoreline/css/unlayered |
@vtex/shoreline/css/tokens | Design tokens (CSS variables) | ✅ | @vtex/shoreline/css/tokens/unlayered |
@vtex/shoreline/css/reset | CSS reset styles | ✅ | @vtex/shoreline/css/reset/unlayered |
@vtex/shoreline/css/base | Base global styles | ✅ | @vtex/shoreline/css/base/unlayered |
@vtex/shoreline/css/components | Component styles | ✅ | @vtex/shoreline/css/components/unlayered |
Note: Layered stylesheets use CSS cascade layers for better style organization and control. Unlayered versions are available for environments that don’t support cascade layers.
The way you will apply the styles in your application depends on the tooling you are using. In the following example we will show how to apply styles using CSS and html style property.
- Check the Design Tokens page to find the token you want to use. For example, the
$space-1token. - Use the token in your application using the
styleproperty.
import '@vtex/shoreline-theme-sunrise/css'
function Example() {
return (
<div style={{ padding: 'var(--sl-space-2)' }}>Example</div>
)
}- You can also use the token in your CSS files.
[data-example] {
padding: var(--sl-space-2);
}