Button

A button element which supports multiple variants, sizes, and colors.

import React from 'react';
import { Button } from '@minddrop/ui';
export const ButtonDemo = () => (
<div style={{ display: 'flex', alignItems: 'center' }}>
<Button>Button</Button>
</div>
);
export default ButtonDemo;

Features

  • Four variant options.
  • Three size options.
  • Start and end icons.
  • Full width option.
  • Supports i18n label.
  • Can be rendered as a as link.

Import the component from the @minddrop/ui package.

Buttons with an i18n label are labeled by passing the i18n key to the label prop.

import { Button } from '@minddrop/ui';
export const SaveButton = ({ onClick }) => {
return <Button label="save" variant="primary" onClick={onClick} />;
};

Buttons without an i18n label are labeled by passing the label directly as the button's children.

import { Button } from '@minddrop/ui';
export const LikeButton = ({ onClick, count }) => {
return (
<Button startIcon="heart" onClick={onClick}>
{count}
</Button>
);
};

Buttons with an href prop are rendered using an a as the root element.

import { Button } from '@minddrop/ui';
export const DocsLink = ({ onClick, count }) => {
return (
<Button variant="text" href="https://developer.minddrop.app">
Developer Docs
</Button>
);
};

ButtonProps extends React.HTMLAttributes<HTMLButtonElement>.

LinkButtonProps extends React.HTMLAttributes<HTMLAnchorElement>.

PropTypeDefault
childrennodeNo default value
disabledbooleanfalse
endIconIconName | ReactElementNo default value
fullWidthbooleanfalse
hrefstringNo default value
labelstringNo default value
size'small' | 'medium' | 'large''medium'
startIconIconName | ReactElementNo default value
startIconNameIconNameNo default value
variant'neutral' | 'primary' | 'danger' | 'text''neutral'

Adheres to the Button WAI-ARIA design pattern.

KeyDescription
SpaceActivates the button.
EnterActivates the button.