Getting Started
Install and configure Vitus Labs in your React project.
Installation
Install the core packages:
npm install @vitus-labs/core @vitus-labs/styler @vitus-labs/connector-styler @vitus-labs/unistyle @vitus-labs/elements @vitus-labs/rocketstyleConfiguration
Initialize the CSS-in-JS engine at the root of your application. This connects the styling engine to all Vitus Labs components.
import { init } from '@vitus-labs/core'
import * as connector from '@vitus-labs/connector-styler'
init({
...connector,
component: 'div',
textComponent: 'span',
})@vitus-labs/connector-styler exposes css, styled, provider, useTheme, keyframes, createGlobalStyle, and useCSS as named exports (no default export). The namespace import above spreads them into init() in one go (init() ignores keys it doesn't use).
@vitus-labs/elements lists @vitus-labs/unistyle as a peer dependency, so install it alongside.
Import this file early in your app entry point (e.g., _app.tsx, layout.tsx, or main.tsx).
Framework Integration
Next.js (App Router)
import '@/init' // Initialize vitus-labs
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}Vite
import './init' // Initialize vitus-labs
import { createRoot } from 'react-dom/client'
import App from './App'
createRoot(document.getElementById('root')!).render(<App />)React Native (Expo)
npm install @vitus-labs/core @vitus-labs/connector-native @vitus-labs/unistyle @vitus-labs/elements @vitus-labs/rocketstyleimport { init } from '@vitus-labs/core'
import { View, Text } from 'react-native'
import {
css,
styled,
provider,
useTheme,
createMediaQueries,
} from '@vitus-labs/connector-native'
init({
css,
styled,
provider,
useTheme,
component: View,
textComponent: Text,
createMediaQueries,
})import './src/init'
import { Element } from '@vitus-labs/elements'
export default function App() {
return (
<Element css={(css) => css`padding: 24px;`}>
Hello from React Native!
</Element>
)
}Key differences from web setup:
- Use
connector-nativeinstead ofconnector-styler - Set
component: ViewandtextComponent: Text(RN primitives instead of HTML tags) - Pass
createMediaQueriesfor responsive breakpoint support - No
@vitus-labs/stylerneeded — the native connector handles CSS parsing internally
See the React Native connector docs for details on how CSS template literals are converted to style objects.
Your First Component
import { Element } from '@vitus-labs/elements'
function Card({ title, children }: { title: string; children: React.ReactNode }) {
return (
<Element
tag="article"
css={(css) => css`
padding: 24px;
border-radius: 8px;
border: 1px solid #e0e0e0;
`}
>
<Element tag="h2" css={(css) => css`margin-bottom: 12px;`}>
{title}
</Element>
{children}
</Element>
)
}Try It Live
Edit the code below to see changes in real time:
What's Next?
- Learn about the styling engine — high-performance CSS-in-JS
- Explore Elements — base UI primitives
- Build composable components with Rocketstyle
- Add animations with Kinetic
- Set up React Native support
Last updated on
Why Vitus Labs
The problem the UI system solves, the principles behind it, honest numbers, and when you should pick something else.
SSR & Static Export
Run the UI system under the Next.js App Router, server rendering and `output: 'export'`. Covers where init() goes, how styles reach the HTML, and how to stay hydration-safe.