Mirotone React is a component library for the Mirotone Design System, offering a range of components and utilities to speed up development for Miro. It draws inspiration from Mirotone CSS and Miro UI Components.
Mirotone React comes with all the basic building blocks to build out a beautiful user interface. It includes all the essentials such as buttons, headings, paragraphs, grids, icons, spinners, form inputs and so much more.
Here is a basic example of how the components can be used:
App.tsx
1import { Button, ButtonProps, Input, InputProps, tokens } from 'mirotone-react';2import { useCallback, useRef, useState } from 'react';34const buttonProps: ButtonProps = {5 size: 'large',6 variant: 'danger',7};89const inputProps: InputProps = {10 size: 'small',11};1213function App() {14 const [value, setValue] = useState('');15 const buttonRef = useRef<HTMLButtonElement>(null);16 const inputRef = useRef<HTMLInputElement>(null);1718 const buttonClickHandler = useCallback(() => {19 if (inputRef.current) {20 inputRef.current.focus();21 }22 }, []);2324 return (25 <>26 <Input27 {...inputProps}28 ref={inputRef}29 value={value}30 onChange={setValue}31 style={{ color: tokens.color.red[800] }}32 />33 <Button34 {...buttonProps}35 ref={buttonRef}36 style={{ borderRadius: tokens.borderRadius.small }}37 onClick={buttonClickHandler}38 >39 Click to focus input40 </Button>41 </>42 );43}4445export default App;
Mirotone React offers a 1 to 1 mapping of all the icons available on Mirotone. To select an icon, simply use the <Icon />
React component and send through the name
prop. which gives you access to over 150 icon tokens.
All icon tokens can be found in the docs. Here is a basic example of how to use an icon with Mirotone React:
1import { Icon } from 'mirotone-react';23const ShapeIcon = () => <Icon name="shapes" />;
Mirotone React promotes consistency in UI. To do so, it provides a fully typed tokens
object that gives you access to font sizes and weights, Miro's color palette, spacing and border-radius values.
Here is a basic example of how to import tokens in your app:
1import { tokens } from 'mirotone-react';
The object contains the following options:
tokens.color
- Color docs
tokens.typography
- Typography docs
tokens.space
- Spacing docs
tokens.borderRadius
- Border radius docs
Mirotone React is designed for the user to compose their UI how they want. This flexibility allows the user to use Mirotone React similarly to lego blocks. The Recipes section on the docs demonstrates how many small components can be glued together to make a composed component.
Here is an example of how an app card is composed:
1<AppCard>2 <AppCardTitle>3 App card title4 </AppCardTitle>5 <AppCardDescription>6 App card description7 </AppCardDescription>8 <AppCardBody>9 <AppCardTags>10 <Tag>11 Tag12 </Tag>13 <Tag backgroundColor="var(--yellow700)">14 Another tag15 </Tag>16 <Tag textColor="var(--green700)">17 Just one more18 </Tag>19 <Tag>20 JIRA-123421 </Tag>22 <Tag icon="link">23 A tag with icon24 </Tag>25 </AppCardTags>26 <Logo />27 </AppCardBody>28</AppCard>
Mirotone React exposes standard HTML DOM props for all of its components. This includes the className
and ref
props so that third-party styling solutions can modify Mirotone React components. Here are some examples of how third-party styling solutions can be applied:
index.css
1.text {2 color: var(--blue600);3 font-weight: bold;4 text-decoration: underline;5 font-size: 1.875rem;6 line-height: 2.25rem;7}
App.tsx
1import styles from './index.module.css';23import { Text } from 'mirotone-react';45const App = () => <Text className={styles.text}>CSS text</Text>;67export default App;
App.tsx
1import { css } from '@emotion/css';23import { Text, tokens } from 'mirotone-react';45const App = () => (6 <Text7 className={css`8 color: ${tokens.color.blue[600]};9 font-weight: bold;10 text-decoration: underline;11 font-size: 1.875rem;12 line-height: 2.25rem;13 `}14 >15 Emotion css prop16 </Text>17);1819export default App;
App.tsx
1import styled from '@emotion/styled';23import { Text, tokens } from 'mirotone-react';45const StyledText = styled(Text)({6 color: tokens.color.blue[600],7 fontWeight: 'bold',8 textDecoration: 'underline',9 fontSize: '1.875rem',10 lineHeight: '2.25rem',11});1213const App = () => <StyledText>Emotion styled component</StyledText>;1415export default App;
index.css
1@tailwind base;2@tailwind components;3@tailwind utilities;
App.tsx
1import './index.css';23import { Text } from 'mirotone-react';45const App = () => <Text className='text-3xl font-bold underline text-blue-500'>Tailwind text</Text>;67export default App;