Overview of Tapestry-React
Tapestry-React is a collection of flexible React components designed to help developers build resilient and accessible user interfaces quickly and effectively.
website·Indexed 29 days ago
https://planningcenter.github.io/tapestry-react/getting-startedA React component library by Planning Center featuring a comprehensive set of UI elements including Modals, Drawers, DataTables, Popovers, and a ThemeProvider for custom styling. The library includes responsive props, variant management via VariantProvider, and specialized components like TileView, WrapView, and various Input and Select fields.
Summary component is used to render a section with a title and a body of text. It is typically used to provide a high-level overview or a summary of a specific topic within a page.render(
<Summary title="Tag Teams">
Our position on Positions is you should take your pointer and position it on the Add tag button above to link some Tags.
</Summary>
);
VariantProvider component is used to toggle style variants on or off. Any prop passed to the VariantProvider is treated as a variant key; when the prop value is set to true, the corresponding variant is activated.<textarea> element, utilizing the InputBox component for consistent styling and behavior within the Tapestry design system.tapestry-react, an "icon set" is a group of product-specific icon paths. By default, all components have access to the general icon set, which contains shared icons used across multiple products. To reference a specific icon, use the following formatting convention: prefix the icon set's name, use dot notation to specify the icon, and render the icon name in camelCase.@planningcenter/tapestry version 2.3.0, you should use the token function from the @planningcenter/tapestry package for color overrides. Using the token function ensures consistent color rendering and proper support for dark mode.useState and useEffect to lazy-load the modal's content only after the modal has been triggered to open. This ensures that heavy components (like Input) are not mounted until the modal transition begins.function MyModal(props) {
const [lazyComponent, setLazyComponent] = React.useState(null);
React.useEffect(() => {
if (props.open) {
setTimeout(() => {
setLazyComponent(<Input />);
}, 0);
}
}, [props.open]);
return (
<Modal open={props.open}>
{lazyComponent}
</Modal>
);
}VariantProvider recognizes focus, hover, and active as reserved variant keys to handle pseudo-state styling.Colors can be applied to components using specific color-related properties. The supported properties for color assignment include:
backgroundColorborderColorborderBottomColorborderLeftColorborderRightColorborderTopColorcolorfillstrokeMenu component as a wrapper and Menu.Item for individual menu entries to create a standard navigation list.render(
<Menu>
<Menu.Item>Item 1</Menu.Item>
<Menu.Item>Item 2</Menu.Item>
<Menu.Item>Item 3</Menu.Item>
</Menu>
);
mediaQueries prop. This prop allows developers to define different property values for different screen breakpoints, enabling layouts to adapt (e.g., switching from a vertical stack on small screens to a horizontal stack on larger screens). The specific breakpoints used are those defined within the ThemeProvider.// Example usage of mediaQueries prop
<Component
mediaQueries={{
// Define prop values for specific breakpoints here
// based on the ThemeProvider configuration
}}
/>MenuItem component is used to create individual selectable items within a menu. It must be used as a child of the Menu component. MenuItem supports highlighting and allows for the inclusion of icons and other elements within the item.