05. Writing your own Components

Ok - so you have everything set up and now you want to change how a particular Resource looks.

For instance, you may want to show a google map for location fields, or even present some values as a graph.

You can do this all by writing your custom components.

Example of overriding how dashboard looks:


const AdminBroOptions = {
  dashboard: {
    component: AdminBro.bundle('./my-dashboard-component')

Dashboard component: ./my-dashboard-component.jsx

import React from 'react'
import { Box } from 'admin-bro'

const Dashboard = (props) => {
  return (
    <Box>My custom dashboard</Box>

export default Dashboard

As you can see AdminBro uses React as a frontend framework. So before you proceed - make sure you know how react works.

Where you can insert your custom components?

Currently, there are 4 places where you can inject components to alter how AdminBro looks:

Requiring component

First of all - you have to require them by using AdminBro.bundle function. What it does - it gives your component unique ID and sends it to the bundling process.

You can do it like this: { component: AdminBro.bundle('./path-to-your-jsx-or-tsx-file') }

All files required by AdminBro.bundle has to have one default export - the one with your react component.

You can use either .jsx or .tsx extension for your components.


AdminBro bundler gives you the ability to import the following dependencies without the need of requiring them in your package.json file:

State management




So you can do something like this:

// your-custom-component.jsx
import React from 'react'
import { withRouter } from 'react-router-dom'

const YourComponent (props) => {...}

export default withRouter(YourComponent)

Props passed to components

In your components, you can use props passed by their controlling components.

Currently we have 2 controlling components:

Check out their documentation to see available props

Dashboard and Pages don't have any controlling component, so they don't receive any props.

Reusing UI Components of AdminBro

AdminBro gives you the ability to reuse its components. You can do this by simply requiring them:

import { Label } from '@admin-bro/design-system'

const YourComponent (props) => {(
  <Label>Some styled text<Label>

We divide components internally into 2 groups:

  • application components - which are imported from 'admin-bro', you can think about them as "smart components"
  • and design system components - they don't require AdminBro and you can use them outside of the AdminBro setup imported from '@admin-bro/design-system'

Each of the components is described with the playground option, so make sure to check out all the documentation of all the components.

One of the most versatile component is a BasePropertyComponent. It allows you to render any property. Combined with useRecord is a powerful tool for building forms.


We support Theme compatible with https://system-ui.com/theme standard.

In order to override default colors, fonts, sizes etc., you can put your values in AdminBroOptions.branding.

Using style props

AdminBro components are supercharged with multiple props controlling styles. For instance in order to change color of a module:@admin-bro/design-system.Button you can pass backgroundColor (bg) from the Theme like that:

<Button bg="primary60"></Button>

For all possible options visit the Theme description.

Adding custom css to component

If using style props is not enough - you can always pass your custom CSS. So for instance let's assume that you would like to overwrite CSS in a Button component. You can do this like that:

import { Button, themeGet } from '@admin-bro/design-system'

const MyButton = styled(Button)`
  background-color: #ccc;
  color: ${themeGet('colors', 'grey100')};

We use styled-components under the hood so make sure to check out their docs. Where themeGet is a helper function from the design-system

Using other AdminBro frontend classes and objects

AdminBro also exposes following classes:

You can use them like this:

import { ApiClient, ViewHelpers } from 'admin-bro'

Proudly built and maintained by SoftwareBrothers

Software House with a passion for both JavaScript and TypeScript.

See what we do See what we believe in

Proudly built and maintained by