Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@bento/box

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bento/box - npm Package Compare versions

Comparing version
0.1.0
to
0.1.1
+64
README.md
# box
The `@bento/box` package provides the shared React context that is used throughout
the Bento component ecosystem.
## Installation
To install the package, use the following command:
```shell
npm install --save @bento/box
```
## Context
```javascript
import { Box } from '@bento/box';
```
The `Box` context is a React context that provides Bento-specific configuration
to child components. It is typically used internally and does not require direct
interaction in most cases.
- **[slots](#slots)**: An object used by the `@bento/slots` and `@bento/use-props` packages.
- **[env](#env)**: An object used by the `@bento/environment` component.
The `Box` context is used to pass down the Bento specific configuration down to
the child components. This is done automatically for you, for the majority of
the cases you don't need to interact or use this context directly in your
application.
<Source language='tsx' code={ SourceNamespace } />
The above example would output the following:
### defaults
The package exposes a `defaults` function that will return the default assigned
values for the `Box` context. You can use this if you need to provide your
components with a custom `Box.Provider`
```javascript
import { Box, defaults } from '@bento/box';
import { useContext } from 'react';
function MyComponent() {
return (
<Box.Provider value={defaults()}>
<MyChildComponent />
</Box.Provider>
);
};
```
### Slots
The `Box` context contains a `slots` object which is consumed by the
`@bento/slots` and `@bento/use-props` packages. This object
contains the following properties:
### Env
The `env` object contains `@bento/environment` specific configuration. The
object contains the following properties:
+2
-1
{
"name": "@bento/box",
"version": "0.1.0",
"version": "0.1.1",
"description": "Shared context for Bento components",

@@ -13,2 +13,3 @@ "type": "module",

"posttest": "npm run lint",
"prepublishOnly": "node ../../scripts/compile-readme.ts",
"pretest": "npm run build",

@@ -15,0 +16,0 @@ "test": "vitest --run",