This library is still in development and is available only for internal usage at VTEX.
Skip to main content

Developing

Quick start

Version: 0.136.0

Quick start

AdminUI is an experimental collection of the reusable components within VTEX admin apps. It is available as an npm package of the name @vtex/admin-ui.

Setup

How to set up admin-ui for different frameworks.

VTEX IO

In the /react folder, install the admin-ui package.

yarn add @vtex/admin-ui

For the root component of the app:

// 1. import the ThemeProvider
import { ThemeProvider } from '@vtex/admin-ui'

function RootComponent() {
// 2. Use at the root of your app
return <ThemeProvider>{/** your app code here */}</ThemeProvider>
}

Multi-route apps

Sometimes the app does not have a single entry. You must add a ThemeProvider to each one of them, like:

Example routes.json:

// /admin/routes.json
{
"app.route1": {
"path": "/admin/route1",
"component": "Root1"
},
"app.route2": {
"path": "/admin/route2",
"component": "Root2"
}
}

For the Root1:

// Root 1

import { ThemeProvider } from '@vtex/admin-ui'

function Root1() {
return <ThemeProvider>{/** your app code here */}</ThemeProvider>
}

For the Root2:

// Root 2

import { ThemeProvider } from '@vtex/admin-ui'

function Root2() {
return <ThemeProvider>{/** your app code here */}</ThemeProvider>
}