2.0.1 • Published 10 months ago

mirotone-react v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Status NPM Version Coverage GitHub Issues GitHub Pull Requests License

Mirotone React

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.

Documentation

For API docs and usage examples, visit the Mirotone React documentation page.

Table of contents

Links

Installation

Install the package as a dependency on your own project by running:

npm install mirotone-react
yarn add mirotone-react
pnpm add mirotone-react

Usage

All components and types are exported from the main package. You can import them as follows:

import { Button, ButtonProps, Input, InputProps, tokens } from 'mirotone-react';
import { useCallback, useRef, useState } from 'react';

const buttonProps: ButtonProps = {
  size: 'large',
  variant: 'danger',
};

const inputProps: InputProps = {
  size: 'small',
};

function App() {
  const [value, setValue] = useState('');
  const buttonRef = useRef<HTMLButtonElement>(null);
  const inputRef = useRef<HTMLInputElement>(null);

  const buttonClickHandler = useCallback(() => {
    if (inputRef.current) {
      inputRef.current.focus();
    }
  }, []);

  return (
    <>
      <Input
        {...inputProps}
        ref={inputRef}
        value={value}
        onChange={setValue}
        style={{ color: tokens.color.red[800] }}
      />
      <Button
        {...buttonProps}
        ref={buttonRef}
        style={{ borderRadius: tokens.borderRadius.small }}
        onClick={buttonClickHandler}
      >
        Click to focus input
      </Button>
    </>
  );
}

export default App;

Tokens

Mirotone React provides a type safe way to access the tokens from Mirotone CSS. Tokens include color, typography, space, borderRadius. All tokens are exported from the main package. You can import them as follows:

import { tokens } from 'mirotone-react';
TokenPathDocumentation
Colortokens.colorColor docs
Typographytokens.typographyTypography docs
Spacingtokens.spaceSpacing docs
Border radiustokens.borderRadiusBorder radius docs

Roadmap

FeatureStatusReference
Dismissable badgeBetaDocs
DropdownBetaDocs
TooltipBetaDocs

Versions

Mirotone ReactMirotone CSSMirotone UI Components
1.x.x5.1.11.4.0
2.x.x5.3.01.4.0

License

Mirotone React is distributed under MIT license, Copyright (c) 2024 Andrew Vo-Nguyen. See LICENSE for more information.

2.0.1

10 months ago

1.3.15

10 months ago

2.0.0

10 months ago

1.3.14

1 year ago

1.3.13

1 year ago

1.3.12

1 year ago

1.3.11

1 year ago

1.3.10

1 year ago

1.3.9

1 year ago

1.3.7

1 year ago

1.3.8

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.2.1

1 year ago

1.1.2

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago