3.1.9 • Published 1 month ago

@leafygreen-ui/box v3.1.9

Weekly downloads
1,078
License
Apache-2.0
Repository
github
Last release
1 month ago

Box

npm (scoped)

View on MongoDB.design

Overview

Box is a polymorphic component that renders a given component depending on the provided props. For example, providing the href prop can indicate Box should be rendered as an anchor tag. Providing the as prop indicates that Box should be rendered as the component referenced by as. By default, Box will render as the HTML element div.

This can be useful for simplifying components that are repetitively used, but need different behaviors.

Installation

Yarn

yarn add @leafygreen-ui/box

NPM

npm install @leafygreen-ui/box

Example

import Box from '@leafygreen-ui/box';

<Box href="https://mongodb.design">I shall render as a link</Box>;

Output HTML

<a href="https://mongodb.design">I shall render as a link</a>

Properties

PropTypeDescriptionDefault
asReact.ElementTypeThe component or HTML tag to be rendered by the <Box /> component. Note: This will supersede the behavior of any other props.div
hrefstringWhen provided, <Box /> will render an anchor tag with this href value.
childrenReact.ReactElementContent to be rendered in an HTML element, or provided as a prop to the rendered component
...native attributes of component passed to as propAny other properties will be spread on the rendered HTML element or component.
3.1.9

1 month ago

4.0.0-alpha.1

10 months ago

3.1.8

9 months ago

4.0.0-alpha.0

10 months ago

3.1.7

9 months ago

3.1.6

9 months ago

3.1.5

10 months ago

3.1.4-next.1

12 months ago

3.1.4-next.0

12 months ago

3.1.4-next.7

12 months ago

3.1.4-next.6

12 months ago

3.1.4-next.5

12 months ago

3.1.4-next.4

12 months ago

3.1.4-next.3

12 months ago

3.1.4-next.2

12 months ago

3.1.4

11 months ago

3.1.3

1 year ago

3.1.2

1 year ago

3.1.1

2 years ago

3.1.0

2 years ago

3.1.0-test.0

2 years ago

3.1.0-next.1

2 years ago

3.1.0-next.0

2 years ago

3.1.0-next.2

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago