I am building out components from a design system. I am looking to organise them neatly.…
- User
I am building out components from a design system. I am looking to organise them neatly. What name should I give the folder where components like Heading1 and BodyText live? is elements correct?
- Assistant
Great question! The naming convention for folders in a design system can vary, but here are some common and clear options for your text-based components like
Heading1,BodyText, etc.:Best Options:
-
typography– This is the most precise and widely used term for text-related components (headings, paragraphs, captions, etc.).- Example:
components/typography/Heading1 - Why? It directly reflects the purpose (styling text) and aligns with design system standards.
- Example:
-
text– Simpler but less explicit than "typography."- Example:
components/text/BodyText
- Example:
Other Alternatives (Less Ideal):
elements– Too vague. "Elements" could mean anything (buttons, icons, etc.).base– Implies foundational components, not just text.atoms(if using Atomic Design) – Works but is overly abstract unless your entire system follows this structure.
Recommendation:
Use
typographyif you want clarity and scalability (e.g., future additions likeCaptionorCodeBlock). Usetextif you prefer brevity and your system is small.Side note: If these components are purely styles (not React/Vue components), consider a
styles/typography.scssortokens/typography.tsinstead.Would you like suggestions for organizing other types of components (e.g., buttons, cards)?
-
- User
if buttons lived in there also would elements be fine
- Assistant
If buttons are also included in the same folder as
Heading1andBodyText, thenelementscould work—but it’s still a bit ambiguous. Here’s a breakdown of your options:1. If You Want a Broad Category (Buttons + Text):
-
elements– Acceptable, but vague.- Pros: Simple, flexible.
- Cons: Could become a "junk drawer" for unrelated components.
- Example:
/elements ├── Button ├── Heading1 └── BodyText
-
primitives– Slightly more precise (implies foundational UI pieces). -
base– Also works if these are low-level building blocks.
2. Better Approach: Split Them Up
typography(for text) +buttons(oractions) – More scalable.- Why? Buttons and text serve different purposes (interactivity vs. readability).
- Example:
/components ├── typography │ ├── Heading1 │ └── BodyText └── buttons └── Button
3. If You Must Group Them Together:
Use
atoms(if following Atomic Design), but only if your entire system uses this structure.Final Recommendation:
- Avoid
elementsunless the folder is strictly for non-interactive primitives (e.g., text + icons). - Prefer separate folders (
typographyandbuttons) for clarity as your system grows.
Would you like a full example of a folder structure for a design system?
-
- User
maybe /components ├── application
└── typography
│ ├── Heading1
│ └── BodyText
└── buttons
└── Button
├── ui more complete ui blocks would go in here like hero, card etc - Assistant
Your structure is almost there! Here’s a refined, scalable version with clear intent for each folder and room for growth:
Recommended Folder Structure
/components ├── foundation/ # Lowest-level primitives (design system "tokens") │ ├── typography/ # Text styles (Heading1, BodyText, etc.) │ ├── buttons/ # Button variants (Primary, Secondary, IconButton) │ └── icons/ # Icon components │ ├── ui/ # Mid-level UI blocks (reusable but not full layouts) │ ├── cards/ # Card variants │ ├── forms/ # Input, Checkbox, etc. │ └── navigation/ # Breadcrumbs, Tabs, etc. │ └── application/ # High-level, context-specific components ├── hero/ # Marketing hero section ├── sidebar/ # App-specific sidebar └── dashboard/ # Complex data widgetsKey Principles:
-
foundation/- Atomic pieces (typography, buttons, icons).
- Naming alternative:
primitives/oratoms/(if using Atomic Design).
-
ui/- Composed blocks (cards, forms) built from foundation components.
- Naming alternative:
blocks/ormolecules/(Atomic Design).
-
application/- Business-specific components (e.g.,
ProductCard,PricingTable). - Naming alternative:
sections/ortemplates/.
- Business-specific components (e.g.,
Why This Works?
- Scalable: No folder becomes a "junk drawer."
- Clear Ownership: Engineers/designers know where to add/edit components.
- Mirrors Design Tools: Matches how Figma/Sketch organize libraries (Base → Components → Patterns).
Adjust Based on Needs:
- Tiny system? Merge
foundationanduiintocomponents/. - Huge system? Split further (e.g.,
data-display/,feedback/for modals/toasts).
Would you like examples of how imports would look in this structure? (e.g.,
import { Button } from '@/components/foundation/buttons') -
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.