Content Modeling
Element Types Reference
Brease supports 14+ element types for defining content fields in sections and collections. This reference covers each type, its frontend value, configuration options, and rendering guidance.
Type Reference
String
| Key | string |
| Frontend value | string |
| Config | required |
Plain text, single line. Render directly.
<h1>{elements.title as string}</h1>
Long Text
| Key | long-text |
| Frontend value | string |
| Config | required |
Multi-line plain text. May contain newlines. Use white-space: pre-line in CSS or split on \n:
<p style={{ whiteSpace: 'pre-line' }}>{elements.description as string}</p>
Rich Text
| Key | richtext |
| Frontend value | string (HTML) |
| Config | required |
HTML string from CKEditor. Render with dangerouslySetInnerHTML:
<div
className="prose"
dangerouslySetInnerHTML={{ __html: elements.body as string }}
/>
Sanitization
Rich text content is HTML generated by CKEditor in the CMS. If you need additional sanitization, use a library like DOMPurify before rendering.
Integer
| Key | integer |
| Frontend value | number |
| Config | required |
Whole number. Render directly.
<span>{elements.count as number} items</span>
Decimal
| Key | float |
| Frontend value | number |
| Config | required |
Floating-point number.
<span>${(elements.price as number).toFixed(2)}</span>
Boolean
| Key | boolean |
| Frontend value | boolean |
| Config | required |
Toggle/switch value. Use for conditional rendering:
{(elements.showBanner as boolean) && <Banner />}
DateTime
| Key | datetime |
| Frontend value | string (ISO 8601) |
| Config | required |
ISO 8601 date string. Parse with new Date() or a date library:
const date = new Date(elements.publishDate as string);
<time dateTime={elements.publishDate as string}>
{date.toLocaleDateString()}
</time>
Media
| Key | media |
| Frontend value | BreaseMedia or BreaseMedia[] |
| Config | required, multiple (boolean), mimeGroup (image/video/audio/document/archive) |
Uploaded file with metadata and responsive variants. Check the multiple config to know if the value is an array.
import { BreaseImage, type BreaseMedia } from 'brease-next';
// Single media
<BreaseImage breaseImage={elements.heroImage as BreaseMedia} />
// Multiple media
{(elements.gallery as BreaseMedia[]).map((img, i) => (
<BreaseImage key={i} breaseImage={img} />
))}
The BreaseMedia object includes:
{
path: string; // Full URL to original file
alt: string; // Alt text
name: string; // File name
width: number; // Original width
height: number; // Original height
mimeType: string; // e.g., "image/jpeg"
mimeGroup: string; // "image", "video", "audio", "document"
variants: BreaseMediaVariant[]; // Responsive variants (sm, md, lg, xl, 2xl, hd)
}
Link
| Key | link |
| Frontend value | BreaseLinkData — { label: string, isExternal: boolean, value: string, target: '_blank' | '_self' | null } |
| Config | required, allowedTypes (page/url/media/entry) |
Use the BreaseLink component — it handles internal vs external links automatically:
import { BreaseLink, type BreaseLinkData } from 'brease-next'
const link = elements.cta as BreaseLinkData
<BreaseLink linkData={link} className="text-blue-600 hover:underline">
{link.label}
</BreaseLink>
BreaseLink renders a Next.js Link for internal URLs and a native <a> with rel="noopener noreferrer" for external ones. It respects the target property from the CMS.
Collection
| Key | collection |
| Frontend value | { name: string, entries: BreaseCollectionEntry[] } |
| Config | collectionId (linked collection UUID) |
Sections only
The collection element type is only available in Sections, not in Collections (to prevent circular references).
Contains the linked collection's entries inline within the section:
import type { BreaseCollection } from 'brease-next'
const testimonials = elements.testimonials as BreaseCollection
{testimonials.entries.map(entry => (
<blockquote key={entry.uuid}>
<p>{entry.elements.quote as string}</p>
<cite>{entry.elements.author as string}</cite>
</blockquote>
))}
Reference
| Key | reference |
| Frontend value | object |
| Config | - |
Used in Page Types for page-level metadata. The value shape depends on the element configuration within the Page Type definition.
Option
| Key | option |
| Frontend value | string or string[] |
| Config | values (array of options), type (select/radio/checkbox) |
Single value for select/radio, array for checkbox:
// Select or radio — single value
const color = elements.theme as string; // "dark"
// Checkbox — array of values
const tags = elements.categories as string[]; // ["news", "featured"]
{tags.map(tag => (
<span key={tag} className="badge">{tag}</span>
))}
List
| Key | list |
| Frontend value | unknown[] |
| Config | required |
Repeater field. An array of items:
const items = elements.features as string[];
<ul>
{items.map((item, i) => (
<li key={i}>{item}</li>
))}
</ul>
JSON
| Key | json |
| Frontend value | any |
| Config | required |
Raw JSON data. Parse and use as needed:
const config = elements.settings as { color: string; size: number };
<div style={{ color: config.color, fontSize: config.size }}>
Custom styled content
</div>
Location
| Key | location |
| Frontend value | { lat: number, lng: number } |
| Config | required |
Geographic coordinates. Use with map libraries:
const location = elements.officeLocation as { lat: number; lng: number };
// Use with Google Maps, Mapbox, Leaflet, etc.
<Map center={[location.lat, location.lng]} zoom={15} />
Quick Reference Table
| Type | Key | Frontend Value | Config Options |
|---|---|---|---|
| String | string | string | required |
| Long Text | long-text | string | required |
| Rich Text | richtext | string (HTML) | required |
| Integer | integer | number | required |
| Decimal | float | number | required |
| Boolean | boolean | boolean | required |
| DateTime | datetime | string (ISO 8601) | required |
| Media | media | BreaseMedia / BreaseMedia[] | required, multiple, mimeGroup |
| Link | link | BreaseLinkData | required, allowedTypes |
| Collection | collection | BreaseCollection | collectionId |
| Reference | reference | object | - |
| Option | option | string / string[] | values, type |
| List | list | unknown[] | required |
| JSON | json | any | required |
| Location | location | { lat, lng } | required |
Type safety
All element values arrive as unknown from the API. Always cast them to the expected type based on your section/collection schema. Define TypeScript interfaces for your section props to get compile-time safety.