@dscout/strata
v2.0.0
Published
A shared component library for building Tailwind based Dscout interfaces
Downloads
363
Readme
@dscout/strata
A shared React component library for building Tailwind based dscout interfaces. The primary consumer is Figma Make, which uses real React components from npm in prototypes.
Installation
npm install @dscout/strataPeer dependencies
React 19+ is required (components rely on React 19's ref-as-a-plain-prop support), and so is React Router 7+ (NavTabs and its dropdowns are barrel exports that read the current route):
npm install react@^19 react-dom@^19 react-router-dom@^7Upgrading to 2.0
PillButtonwas removed. UseChipfor a pill-shaped label, orButtonfor an action.react-router-domis a required peer dependency. It was optional in 1.x.
Usage
// CSS (required — contains all Tailwind utilities and design tokens)
import '@dscout/strata/styles.css';
// Components and their types, from the package root
import { Button, Modal, type ButtonProps, type ModalProps } from '@dscout/strata';Import from the package root. Every component's props type ships from the root as <Component>Props (e.g. ButtonProps, FilterBarProps, QuestionGroupProps), alongside the value and option types its props reference.
Per-component subpaths (@dscout/strata/button, @dscout/strata/popover/menu-item, …) also exist, for consumers that need to code-split a single component. They use kebab-case and mirror the source folder. A subpath is not guaranteed to re-export its component's types, so import types from the root.
Components
Buttons & inputs
Button,ButtonWithTooltipAndPopover,PromptButton,SendButton,SourceButtonCheckboxInput,RadioInput,Switch(+SwitchColortype)TextInput,TextareaDatepickerSelect
Surfaces & layout
ModalPopover,PopoverMenu,PopoverMenuItem,PopoverSurfaceTooltipContainer,TooltipProviderCalloutCollapsibleContentScrollFadeContainerResizeHandle,useResizeHandleWorkspaceLayout,useWorkspaceLayout,useNavState(plusWorkspacePane,WorkspaceState,WorkspaceAction,WorkspaceLayoutHandle,WorkspaceLayoutProps,PrimaryHeaderProps,SecondaryHeaderProps,PaneProps,NavPropstypes)Table(+Column,TableRow,SortDir,SortState,TableProps,TablePaginationPropstypes) — sort/resize/reorder/hide columns, row selection, a frozen first column, andloading/loadingMore/onLoadMorepagination states. Body rows are always virtualized (@tanstack/react-virtual, no opt-out): only the rows in view plus a small fixed buffer are ever mounted, sorole="row"elements you query in a consuming app's own tests won't match the fullrowsarray for a long table.aria-rowcount/aria-rowindexare published on the table/rows to tell assistive tech the true row count and position even though only a window of rows is in the DOM at once.
Filtering
Strata holds no filter model: the consumer supplies the options, operators, conditions and labels, and applies every change the components report.
FilterBar(+FilterBar.Item) — the strip that hosts filter chips, conjunctions and the add-filter control, as a single tab stop with arrow-key navigationFilterChip— one filter condition that reads as a sentence: category, operator, values, removeFilterGroupChip— a group of conditions summarized as one sentence, opening an editor ofFilterChiprowsFilterConjunction— the connector the consumer places between chips, optionally toggleableAddFilterButton,AddFilterMenu— the add-filter trigger and its nested submenus of checkbox lists by category, with optional saved viewsFilterAnnouncer— holds the polite live region filter changes are announced in. Wrap it around aFilterBarthat unmounts when it has no filters, so removing the last filter is still announced.
Chat & command surfaces
ChatMessage,ChatMessagesArea,ChatThinkingIndicator,MessageTextareaCommandMenu(compound:.Search,.Filters,.List,.Item),CommandAnchoredMenu,CommandPopover
Question authoring
QuestionCard— the card shell (header + removable settings chips + kebab menu + label + kind-specific body)QuestionLabel— the editable/read-only question labelQuestionSettingsMenu— the card's kebab/duplicate/delete menu, with anextraItemsslot for kind-specific controlsMenuItemRow— structural row helper for composing custom content insideQuestionSettingsMenu'sextraItemsAddQuestionButtonQuestionGroup(+QuestionGroupProps,QuestionGroupLabelsand related types) — a header above a tinted surface holding a nestedSortableListContainerof the consumer's questions, collapsing to a summary bar. Presentational: the questions, their numbering and the settings menu's actions belong to the consumer.Multivariate(+MultivariateProps,MultivariateVariantConfig,MultivariateLabelsand related types) — a header with Add variant above a stack of variant trays that reorder within the block, collapsing to a summary bar of the variants' letters. Presentational, likeQuestionGroup.EditableCardSort(+EditableCardSortProps,CardSortItemtypes) — card-sort question editing: two independentEditableListinstances (Cards always, Categories optional), each with its own add/remove/reorder/lock axes and opt-in max-item capEditableList,EditableListRow(+EditableListProps,EditableListRowProps,EditableListItemArgstypes) — choice/rank question list editing: add/remove/reorder, three independent lock axes, an optional pinned (non-reorderable) item. Whenitemsis empty,EditableListrenders one synthetic row viarenderItemwithargs.isSynthetic: true— check it before reading any other field offitem(the sentinel carries no real data). Render that branch throughPlaceholderEditableListRow(+PlaceholderEditableListRowPropstype), which owns the synthetic row's full contract (blank value, no-op remove, locked/focus forwarding, reserved remove-button footprint) instead of hand-composingEditableListRowfor it.EditableScale(+EditableScalePropstype) — scale question editing: editable low/high labels, a numbered scale box row, an optional "Not applicable" rowEditableTreeTest(+EditableTreeTestProps,TreeNodetypes) — tree-test question display: a nested, indented outline with leaf/branch markers, working expand/collapse, and a correct-destination indicator. Read-only for now — no editing, drag/drop, or add/remove mutations; a future ticket adds interactivity to this same component.EditableUrl(+EditableUrlPropstype) — URL/link question editing: input → loading → resolved-preview → invalid states, add/edit/remove/cancel, with aninstanceLabelescape hatch for disambiguating multiple instances on one pageFollowupInstructions(+FollowupInstructionsPropstype) — AI Mod follow-up policy editor: a mode/count selector plus optional free-text guidance for the moderator. Kind-agnostic — the consumer supplies the mode options and their copy; the on/off control lives outside this component.QuotaMenu(+QuotaMenuProps,QuotaMenuValuetypes) — per-choice quota configuration popover: even-split or numeric-per-choice modes, with pending-value staging until commit.ResponseDisplay(+ResponseDisplayProps,ResponseQuestion,SupportedResponseKind,isResponseDisplaySupported, and per-kind question types) — renders a question's response for a givenQuestionKind, in either fulltranscriptor compactcitationmode.ResponseDisplayStatCellandresolveSelfReportedLabelare shared pieces used by transcript surfaces that render a self-report row outside the full component.SortableListContainer(+SortableListContainerProps,SortableListContainerOwnerProps,SortableListMoveEvent,SortableListActivationMode,SortableListContainerNestedPropstypes) — generic@dnd-kit-backed drag-and-drop primitive for reordering an arbitrary item array, with pointer + keyboard support and opt-in cross-instance movement, including keyboard moves across nested lists. A nested owner names items in its drag announcements throughgetItemLabel, andannouncements(+SortableListAnnouncements,SortableListAnnouncedPlacetypes) replaces their English text. Nested-mode hooks (useSortableListDropRegion,useSortableListArrangement,useSortableListArrangementInput,useSortableListIds,useSortableListDragActive,useSortableListRowState, +SortableListArrangementtype) ship from the package root.
Text & rich content
Markdown— opinionated markdown renderer. The individual block renderers are exposed too as drop-incomponents={...}overrides:BasicMarkdownRenderer,MarkdownBlockquote,MarkdownCode,MarkdownListItem,MarkdownParagraph.FormattedTextarea,MentionSuggestionListEditableTextField— standalone contentEditable primitive (blur-commit, paste-stripping,maxLength)
Tabs
Tabs(+TabsList,TabsTrigger,TabsContent),TabsDropdown,TabsDropdownItemFilterTabs(+FilterTab,FilterPill)NavTabs(+NavTab),NavTabsDropdown,NavTabsDropdownItem— route-driven tabs; render them inside a React Router.
Motion
duration,ease,spring— Strata's motion tokens formotion/react. Durations are in seconds; the matching CSS tokens instyles.cssare in milliseconds.useMotionTransition,resolveMotionTransition— resolve tokens to amotion/reacttransition, collapsing to an instant one underprefers-reduced-motionfadeInOut— opacity crossfade variants
Notifications & status
ToastContainer,ToastActions,useToastStoreLoadingDots,LoadingSpinner,LogoLoader,SkeletonLoader,TypingIndicator
Miscellaneous
Chip(+ChipProps,ChipColor,ChipLeadingContenttypes) — a compact, pill-shaped label chip with an optional leading icon/leadingSlotand an optional hover/focus-reveal dismiss control. Breaking change: theprimaryandtipcolor variants were removed —ChipColoris now"white" | "gray"only, and the defaultcolorchanged fromgraytowhite. Update anycolor="primary"/color="tip"usage to"white"or"gray", and passcolor="gray"explicitly if you relied on the old default.FeedbackSelector(+Ratingenum)ProfileDropdownQuestionIndicatorResourceItem,ResourceItemButtonUserAvatar
Browse interactive examples in the Storybook.
Intentionally internal
Some primitives in the Strata source tree are deliberately not exposed via this package. External consumers should compose around the public primitives instead:
- Component-folder
internals/. Strata's complex component folders (chat/,workspace_layout/,markdown/,scroll_fade_container/,command_menu/,tabs/,question_card/, …) keep implementation detail under aninternals/subdirectory — editor wiring, popover shells, suggestion-extension factories, reducers, FSM machinery, layout shells, the settings-chips overflow row, etc. None of those modules ship as package entry points, and the in-repo ESLint ruledscout/no-strata-internals-cross-folderenforces the boundary at build time. If you find yourself wanting to reach into aninternals/module, that's a signal that the public surface is missing something — open an issue rather than working around it. ResourceItem/ResourceItemButton— subgrid mode is internal. Both components are exposed and render with their default flex layout out of the box. The mechanism that auto-activates leading / title / trailing alignment across a list of rows — theResourceItemListProvidercontext and matching parent grid template — is not exported. External consumers will get the standalone (flex) behavior; the aligned-list behavior lives behind a follow-up primitive (e.g. a futureResourceItemListthat bundles the parent grid + provider). Until that lands, this is the supported public contract.CheckboxIndicator— prop-driven visual sibling ofCheckboxInput. Exists to deduplicate the checkbox visual contract betweenCheckboxInputand<button>-rooted Items (e.g.CommandMenu.Item), both of which live inside this monorepo. External Strata consumers should useCheckboxInputfor real form input.ErrorBoundaryand friends. Depend on@datadog/browser-rum-react, which is app-specific and not appropriate for the package.
