Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@leafygreen-ui/box

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafygreen-ui/box

leafyGreen UI Kit Box

  • 3.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
decreased by-62.95%
Maintainers
2
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 12 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc