---
title: "markdown"
image: "https://adonia.pages.dev/og.png"
version: "next"
---

> Documentation Index
> Fetch the complete documentation index at: https://adonia.pages.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# markdown

<!-- Generated by `pnpm docs:fields` from packages/core/src/schema/fields/markdown.ts. Edit the TSDoc, not this file. -->

Markdown source editor bound to a string attribute.

| | |
| --- | --- |
| Builder | `F.markdown(attribute: string): MarkdownField` |
| Wire type key | `markdown` |
| Class chain | `MarkdownField` → `Field` |
| Detail projection | `text-entry` |
| Column counterpart | `text` cell, i.e. `C.text(attribute)` |

## Example

```ts
import { F } from '@adonia/core'

F.markdown('body').label('Body').preview('side-by-side').rows(24).maxLength(50_000)
```

## Props

Beyond the shared [field DSL](/reference/fields#the-shared-field-dsl):

| Prop | Declared on | Behaviour |
| --- | --- | --- |
| `preview(mode: MarkdownPreview): this` | `MarkdownField` | Preview layout; `side-by-side` by default (§7.3). |
| `rows(count: number): this` | `MarkdownField` | Initial editor height in rows; the client's default applies when unset. |
| `toolbar(...items: string[]): this` | `MarkdownField` | Restricts the editor's toolbar to the listed markdown constructs (`'bold'`, `'link'`, `'code'`, …). A rendering hint only: markdown typed by hand is still markdown, so the server neither enforces nor strips anything the toolbar omits. |

## Validation

Vine base: `vine.string()`.

§11.1 mapping: `vine.string()` with the declared length bounds.

No `trim()`: two trailing spaces are a hard line break in markdown, and
a validator that removed them would silently rewrite the document.

Contributed by `MarkdownField.vineSchema()` in `packages/core/src/schema/fields/markdown.ts`. The shared modifiers (`required`, `nullable`, `requiredWhen`, `unique`, optionality) are applied on top by `Field.buildValidation`, and a `rules()` override replaces the base entirely — the validator compiler never branches on the field class.

## Declared in

- `packages/core/src/schema/fields/markdown.ts` — `MarkdownField`

Source: https://adonia.pages.dev/reference/fields/markdown/index.mdx
