@still-forest/canopy
v0.85.1
Published
React components, built with Tailwind CSS, Shadcn, and VisX
Readme
Canopy
React components, built with Tailwind CSS, Shadcn, and VisX
Resources
- Github repo
- Distribution
- Building blocks
- Documentation via Storybook
- Github Pages - docs only
- Development
- Other documentation, documents
Usage
Installation
Canopy provides foundational styles (colors, theme, typography, dimensions) as importable CSS. Import the styles in your primary .css file:
@import "tailwindcss";
@import "@still-forest/canopy/styles";
@source "../node_modules/@still-forest/canopy/dist";
@layer base {
/* your usual CSS definitions */
}The @import provides Canopy's design tokens, theme variables, and utility classes. The @source directive ensures Tailwind detects classes used by Canopy components (docs).
You can also import individual style modules:
@import "@still-forest/canopy/styles/theme.css";
@import "@still-forest/canopy/styles/typography.css";Customization
Override any Canopy design tokens by redefining CSS variables after the import:
@import "@still-forest/canopy/styles";
:root {
--font-brand: "My Custom Font", serif;
--color-brand: #4a90d9;
}z-index layering
Overlay components (backdrops, Sheet, Dialog, Drawer, Popover, DropdownMenu, Select, Combobox) share a single z-index and portal to the end of <body> when opened, so whatever opened last stacks on top. This works in both directions: a Select inside a Sheet, and a Sheet opened from a Popover.
| Token | z-index | Components |
|-------|---------|------------|
| z-sticky | 30 | Sticky headers/footers |
| z-overlay, z-surface, z-popup | 50 (--z-index-layer) | Everything that portals |
| z-tooltip | 70 | Tooltip |
Non-portaled elements shouldn't use z-overlay/z-surface/z-popup: they'd tie with portaled layers and lose on DOM order.
Testing locally
Using pnpm link
- In this package, run build in watch mode:
pnpm build:watch- In the consuming package, link package.json to the locally built version:
pnpm link ~/Development/path/to/canopy- When done, cleanup:
pnpm unlink ~/Development/path/to/canopy
pnpm store prune # clear pnpm's global storeUsing pnpm add
- In this package, run build in watch mode:
pnpm build:watch- In the consuming package, point package.json to the locally built version:
pnpm add ~/Development/canopyDirect file copy
Alternatively, directly copy the built version periodically:
rm -rf ./node_modules/@still-forest/canopy/dist && cp -r ~/Development/canopy/dist ./node_modules/@still-forest/canopy/dist