Components
A Component in components/ declares typed props and renderings once, shared by every Site, App and Dashboard.
A Component in components/ declares its typed props and renderings once. Every Site, App and Dashboard of the Startup uses it.
components/RenewalCountdown.mdxprops and renderingsRenewalCountdown.tsxits web renderingRenewalCountdown.cssits scoped CSS
Reference
| File | Holds |
|---|---|
[Name].mdx | Frontmatter props and renderers; the body documents it |
[Name].tsx | The web rendering, composed from startup-builder/ |
[Name].css | One scoped layer of CSS |
A prop's type is a scalar or a Noun name. renderers lists web, native and markdown; each Component renders for people, native clients and agents.
Examples
Minimal
---
props:
lease: { type: Lease, required: true }
renderers: [web, markdown]
---Leaseline
Leaseline declares a Lease Noun.
import { StateBadge, Timeline } from 'startup-builder/ ui'
export default function RenewalCountdown({ lease }: { lease: Lease }) {
const days = Math.ceil((Date.parse(lease.endsOn) - Date.now()) / 86_400_000)
return (
<section>
<h3>{lease.unit}: {days} days to renewal</h3>
<StateBadge thing={lease.$id} />
<Timeline thing={lease.$id} />
</section>
)
}What it builds
The SiteBuilder compiles the files.
- a
Componentwhose props become typed for every Page, view and Dashboard - its Markdown rendering, so agents read what people see
Good to know
- The built-in catalog is UI components.