Socket
Book a DemoInstallSign in
Socket

@leafygreen-ui/box

Package Overview
Dependencies
Maintainers
6
Versions
49
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

5.0.1
latest
Source
npmnpm
Version published
Weekly downloads
42K
1.81%
Maintainers
6
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

PNPM

pnpm add @leafygreen-ui/box

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>;

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 03 Sep 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.