shadcn.io is not affiliated with official shadcn/ui
Discipline Tabs Craft About Block for React
Tabs for four disciplines of a design-to-code tool: each panel lists three principles with a before and after sample and the figure that changed.
Installation
Overview
Discipline tabs for React with Base UI, written for Craftlane, a fictional design-to-code tool. A start-aligned header sits over a band of four line tabs (Engineering, Design, Writing, Support). Each panel is a list of three principles ruled from rail to rail: the principle, one sentence and the figure it changed at the start, and at the end a "Before" and an "After" sample, in monospace when the sample is code and in plain type when it is copy. Every panel's rows are stacked, unseen, under the open one, so choosing a discipline never moves the page. On a phone the tab list scrolls sideways and the two samples stack. It's built from Tabs and Guides, with CSS transitions for the entrance and your theme's tokens for every colour. For product and engineering teams that want to show how each discipline works, with proof. The figures and samples are example data.
FAQ
How do I change the disciplines and principles?
Edit DISCIPLINES at the top of the file: each has a label and its principles, and each principle a title, a sentence, a before and an after sample, a result (the figure, with its sign) and the measure it counts. Set mono to true when the samples are code. Add a discipline and it gets its own tab; the unseen stack that holds the height includes it automatically.
How do the tabs work for a keyboard or a screen reader?
Tab moves to the tab list; the arrow keys move between the disciplines (Home and End go to the first and last), and the panel follows. Each principle is an h3 and each sample pair is a description list reading "Before" then its text, "After" then its text, so a screen reader hears them in the right order.
Why is the page the same height in every tab?
All four panels are rendered in the same grid cell, and the unseen copies make the cell as tall as the tallest panel. Switching tabs then swaps what is visible and shifts nothing below.
How are the figures written for a right-to-left reader?
A figure such as "−62%" is wrapped in a bdi with dir="ltr" and uses a true minus sign, so the sign stays beside the number in a right-to-left layout. The "Before" and "After" marks are a cross and a tick next to the word, not a colour.
Related
- Pro
Situation Tabs Operating Principles
Principles and processAn operating-principles section for an accounting-automation company: line tabs by situation, and under them the open situation's three rules as hairline rows, each with the question we ask.
- Pro
Do and Don't Design Principles
Principles and processA design-principles section for a design-system manager: four principles in cells, each with its test as a question and the same screen sketched done well and done badly.
- Pro
Vertical Tabs Lessons Learned
TimelinesA lessons-learned section for a retrospectives tool: a vertical tab list of six post-mortems with the year each happened, and the open one as what happened, what we learned and what changed.
- Pro
Before After Toggle Feedback Culture
Culture and valuesA feedback culture section for a peer review tool: five habits of a good review comment, each with the vague sentence most people write and the useful rewrite, flipped by a Before / After toggle.
- Pro
Filterable Bill of Materials Tech Stack
Security and platformA bill of materials for a build tool: a filter field and a framed, scrolling table of 24 technologies grouped by layer, each with a monospace version and what it is used for, with an empty state.
- Pro
Sortable Skills Matrix About
Team and officesA framed matrix of seven skills by five departments for a learning platform, each cell four dots, sortable by skill or department, with computed department averages in the footer row.