Skip to content
react-structuredv0.2.0
On this page
  1. Inline data
  2. Separate typed data
  3. Props

Schema

Render a single Schema.org entity with exhaustive schema-dts typing.

Schema derives its data type from the type prop. Any Schema.org Thing type represented by schema-dts is supported, not just the rich-result helpers.

Inline data

tsx
import { Schema } from 'react-structured'

;<Schema
  type="Movie"
  data={{
    name: 'The Matrix',
    director: { '@type': 'Person', name: 'The Wachowskis' },
  }}
/>

Separate typed data

tsx
import { Schema, type SchemaData } from 'react-structured'

const course = {
  name: 'Introduction to TypeScript',
  provider: { '@type': 'Organization', name: 'Example University' },
} satisfies SchemaData<'Course'>

<Schema type="Course" data={course} />

The top-level @type is optional in data. If supplied, it must match the selected type. Nested entities still need their own @type.

Props

PropPurpose
typeRequired Schema.org type name
dataRequired SchemaData<T> for that type
idDocument-unique script ID
nonceApplication-provided CSP nonce
scriptKeyReact key for the emitted script
validateDevelopment-time rich-result warnings; defaults to true

Schema owns the final top-level @context and @type, including for JavaScript callers. See security for script serialization and CSP details.

By

Commune Software