Skip to content

Frontmatter field enums → dropdowns in the editor (per-folder allowed values) #368

Description

@tobiashill666

Problem

Frontmatter fields in the editor are all free-text. For controlled fields — tags, type, context — that means typos and quiet drift, and there's no way to see the allowed values while editing. Re-typing a known vocabulary by hand defeats the point of having one.

Proposal

Let a folder declare allowed values per field, and have the editor render a dropdown instead of a text input.

Declaration in the existing .ok/frontmatter.yml (new, optional _schema block):

_schema:
  type:
    enum: [note, person, project, concept]
  tags:
    type: list
    enum: [docs, internal, wip]
  • folder-config-get returns this as frontmatter_schema.
  • FrontmatterRow routes a field that has an enum to a new SelectWidget (reusing the existing Radix <Select>): single-select for scalars, multi-select for list/tags.
  • No declaration → unchanged free-text. Fully backward-compatible.

Why this shape

  • Reuses what's already there — the Radix Select, and the {type:'enum', values} pattern you already use for MDX component attributes.
  • Folder-scoped, so each area defines its own vocabulary.
  • Additive: no change to the existing frontmatter types.

Happy to implement it if the design works for you — including where you'd prefer the declaration to live (.ok/frontmatter.yml vs a separate .ok/schema.yml).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions