This document provides precise implementation instructions for creating
embedded applications using the Bespoke Simulation template. Follow these
instructions exactly to ensure consistency across all applications.
NOTE: Never edit this BESPOKE-TEMPLATE.md file. Codebase changes should be reflected in the AGENTS.md file.
Every application should include these files in the following order:
- CodeSignal Design System foundations:
- colors/colors.css
- spacing/spacing.css
- typography/typography.css
- components/button/button.css (used in header)
- CodeSignal Design System components (optional):
- components/boxes/boxes.css
- components/dropdown/dropdown.css
- components/input/input.css
- components/tags/tags.css
- bespoke-template.css (template-specific layout, utilities, temporary components)
- components/modal/modal.css and modal.js (design system; used for help modal)
- app.js (application logic)
- server.js (server)
-
REPLACE the following placeholders in index.html EXACTLY as specified:
a)
<!-- APP_TITLE -->Replace with your application's page title Example: "Database Designer" or "Task Manager"b)
<!-- APP_NAME -->Replace with your application's display name (appears in header) Example: "Database Designer" or "Task Manager"c)
<!-- APP_SPECIFIC_MAIN_CONTENT -->Add your application's main content area Example:<div id="canvas"></div>or<div id="editor"></div>d)
<!-- APP_SPECIFIC_CSS -->Add links to your application-specific CSS files Example:<link rel="stylesheet" href="./my-app.css" />e)
<!-- APP_SPECIFIC_SCRIPTS -->Add links to your application-specific JavaScript files Example:<script src="./my-app-logic.js"></script> -
DO NOT modify the core structure (header, script loading order, etc.)
- ALWAYS use the
.bespokeclass on the body element for scoping - USE design system components directly with proper classes:
- Buttons:
button button-primary,button button-secondary,button button-danger,button button-text - Boxes/Cards:
box cardfor card containers - Inputs: Add
inputclass to input elements:<input type="text" class="input" />
- Buttons:
- USE design system CSS custom properties for styling:
- Colors:
--Colors-*(e.g.,--Colors-Primary-Default,--Colors-Text-Body-Default) - Spacing:
--UI-Spacing-*(e.g.,--UI-Spacing-spacing-ml,--UI-Spacing-spacing-xl) - Typography:
--Fonts-*(e.g.,--Fonts-Body-Default-md,--Fonts-Headlines-sm) - Borders:
--UI-Radius-*(e.g.,--UI-Radius-radius-s,--UI-Radius-radius-m) - Font families:
--body-family,--heading-family
- Colors:
- FOR custom styling, create app-specific CSS files
- OVERRIDE design system variables in your app-specific CSS, not in bespoke-template.css
- FOLLOW design system naming conventions for consistency
- HELP MODAL SETUP:
a) Create help content using help-content-template.html as reference
b) Use the design system Modal:
Modal.createHelpModal({ title: 'Help', content, triggerSelector: '#btn-help' })c) Includemodal.cssand importModalfromdesign-system/components/modal/modal.js
- WRAP all async operations in try-catch blocks
- PROVIDE meaningful error messages to users
- LOG errors to console for debugging
- IMPLEMENT retry logic for network operations
- HANDLE localStorage quota exceeded errors
- VALIDATE data before saving operations
- CSS files: kebab-case (e.g., my-app.css, task-manager.css)
- JavaScript files: kebab-case (e.g., my-app.js, task-manager.js)
- Data files: kebab-case (e.g., solution.json, initial-data.json)
- Image files: kebab-case (e.g., overview.png, help-icon.svg)
This section explains how to use the CodeSignal Design System with the Bespoke template for embedded applications.
The Bespoke template uses the CodeSignal Design System for components and
tokens, with template-specific layout and utilities. All styles are scoped
under the .bespoke class to prevent interference with parent site styles.
The template uses design system components directly where available, and
provides temporary components (modals, form elements) that will be replaced
when the design system adds them.
<link rel="stylesheet" href="./bespoke-template.css" /><div class="bespoke">
<!-- Your embedded application content goes here -->
</div><div class="bespoke">
<header class="header">
<h1>My App</h1>
<button class="button button-text">Help</button>
</header>
<main class="main-layout">
<aside class="sidebar">
<section class="box card">
<h2>Settings</h2>
<form>
<label>Name
<input type="text" class="input" placeholder="Enter name" />
</label>
<button type="submit" class="button button-primary">Save</button>
</form>
</section>
</aside>
<div class="content-area">
<!-- Main content -->
</div>
</main>
</div><header class="header">
<h1>App Title</h1>
<button class="button button-text">Help</button>
</header><main class="main-layout">
<aside class="sidebar">
<!-- Sidebar content -->
</aside>
<div class="content-area">
<!-- Main content area -->
</div>
</main><section class="box card">
<h2>Card Title</h2>
<h3>Subtitle</h3>
<p>Card content goes here</p>
</section><!-- Vertical label -->
<label>Field Name
<input type="text" class="input" />
</label><!-- Text input -->
<input type="text" class="input" placeholder="Enter text" />
<!-- Select dropdown - native select styling is custom; design system has a Dropdown JS component for richer dropdowns -->
<select class="input">
<option>Option 1</option>
<option>Option 2</option>
</select>
<!-- Checkbox (design system component) -->
<label class="input-checkbox">
<input type="checkbox" />
<span class="input-checkbox-box"><span class="input-checkbox-checkmark"></span></span>
<span class="input-checkbox-label">Checkbox Label</span>
</label>
<!-- Radio buttons (design system component) -->
<label class="input-radio">
<input type="radio" name="option" value="a" />
<span class="input-radio-circle"><span class="input-radio-dot"></span></span>
<span class="input-radio-label">Option A</span>
</label>
<label class="input-radio">
<input type="radio" name="option" value="b" />
<span class="input-radio-circle"><span class="input-radio-dot"></span></span>
<span class="input-radio-label">Option B</span>
</label>
<!-- Textarea -->
<textarea class="input" placeholder="Enter your message here..."></textarea>
<!-- Toggle switch - custom component; no design system equivalent yet. Add body-xsmall for typography -->
<label class="row">
<div class="toggle">
<input type="checkbox" class="toggle-input" />
<span class="toggle-slider"></span>
</div>
<span class="toggle-label body-xsmall">Enable notifications</span>
</label><!-- Text button (default style) -->
<button class="button button-text">Click Me</button>
<!-- Button variants -->
<button class="button button-primary">Primary Action</button>
<button class="button button-danger">Delete</button>
<button class="button button-tertiary">Secondary</button>
<!-- Button as link -->
<a href="#" class="button button-text">Link Button</a>Use the design system Modal component for help/documentation:
import Modal from './design-system/components/modal/modal.js';
const helpModal = Modal.createHelpModal({
title: 'Help',
content: document.querySelector('#help-content').content.cloneNode(true),
triggerSelector: '#btn-help'
});
helpModal.open();Include modal.css and modal.js in your app. See client/design-system/components/modal/README.md for full API.
Customize via design system CSS variables (--Colors-*, --UI-Spacing-*, --Fonts-*, --UI-Radius-*). See design system files for available tokens.
The framework automatically detects the user's system preference and switches between light and dark themes. No additional configuration is needed.
<div class="bespoke">
<header class="header">
<h1>DB Schema Designer</h1>
<button id="btn-save" class="button button-primary">Save</button>
<button class="button button-text">Help</button>
</header>
<main class="main-layout">
<aside class="sidebar">
<section class="box card">
<h2>New Table</h2>
<form>
<label>Table name
<input type="text" class="input" placeholder="users" />
</label>
<button type="submit" class="button button-primary">Add Table</button>
</form>
</section>
</aside>
<div class="content-area">
<!-- Diagram area -->
</div>
</main>
</div>- Always wrap in
.bespoke: This prevents style conflicts with the parent site - Use design system components directly: Use proper class combinations like
button button-primary - Use semantic HTML: Combine with proper HTML elements for accessibility
- Customize via design system CSS variables: Override design system variables in your app-specific CSS
- Test in both themes: Ensure your app works in light and dark modes
- Note on temporary components: Modal and form components in
bespoke-template.cssare temporary and will be replaced when the design system adds them