Overview of Bento Design System for React
Bento is a configurable and extensible Design System for React designed to serve as a foundation for a project's own Design System. It provides a set of components and resources to accelerate UI development.
website·Indexed 32 days ago
https://developer.bento-ds.com/A React-based design system providing a comprehensive library of components including form fields, charts, and layout utilities. It utilizes Atomic CSS principles, integrates react-aria for SSR support, and offers customization through the makeGlobalBentoTheme utility and BentoProvider.
ContentWithSidebar component renders a main content area and a sidebar. To ensure a logical tab and focus order for accessibility, the component is designed to always render the main content before the sidebar in the DOM.Bento components can be customized to meet project-specific needs through three primary methods:
Box component is the primary building block of the Bento design system. It serves as a type-safe JSX equivalent to the sprinkles function, acting as a drop-in replacement for div (though the rendered HTML element can be changed using the as prop). By default, it uses the standard bentoSprinkles configuration.DisclosureGroup component is used to create a group of collapsible content sections. In other UI libraries, this component is commonly referred to as an Accordion.withBentoConfig utility to create multiple variants of a single component with different configurations. This is useful when you need the same component to behave differently in different contexts (e.g., a square chip vs. a pill-shaped chip) without changing the global provider configuration.import { Chip, withBentoConfig } from "@buildo/bento-design-system";
export const { Chip: SquaredChip } = withBentoConfig(
{
chip: { radius: 0 },
},
Chip
);
export const { Chip: PillChip } = withBentoConfig(
{
chip: { radius: "circledX" },
},
Chip
);AreaLoader (referred to as Loader in some contexts) renders an animated indefinite loader centered within its parent container. Because it is absolutely positioned, it will cover the closest ancestor element that has position: relative.<Card padding="24">
<Box position="relative">
{cardContent}
{isLoading && <AreaLoader />}
</Box>
</Card>makeGlobalBentoTheme utility allows you to create a global CSS theme file. It is a wrapper around Vanilla Extract's createGlobalTheme and requires Vanilla Extract to be set up in your project. You can define a subset of design tokens; any tokens not explicitly set will fall back to the Bento default theme. The resulting theme.css file should be imported in your app in place of defaultTheme.css.// my-project/design-system/src/theme.css.ts
import { makeGlobalBentoTheme } from "@buildo/bento-design-system";
makeGlobalBentoTheme({
fontFamily: {
default: "Arial",
},
});issues prop (a non-empty array of errors) and the renderIssue prop. renderIssue is a required function (issue: E | ErrorCode, file?: File) => Children that defines how user-friendly error messages are displayed under the field.showToast function provided by the useToast hook to programmatically trigger toast notifications.