Skip to content

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 renderings
  • RenewalCountdown.tsxits web rendering
  • RenewalCountdown.cssits scoped CSS

Reference

FileHolds
[Name].mdxFrontmatter props and renderers; the body documents it
[Name].tsxThe web rendering, composed from startup-builder/ui
[Name].cssOne 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

components/RenewalCountdown.mdx
---
props:
  lease: { type: Lease, required: true }
renderers: [web, markdown]
---

Leaseline

Leaseline declares a Lease Noun.

components/RenewalCountdown.tsx
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 Component whose props become typed for every Page, view and Dashboard
  • its Markdown rendering, so agents read what people see

Good to know