<baht-markdown>
Markdown field: Write and Preview tabs, with files pasted, dropped or picked in as links. Apps need the marked and dompurify peers.
Basic
Events (baht-input, name)
<baht-markdown></baht-markdown>
<script>
const el = document.querySelector('baht-markdown');
el.field = {
"order": 1,
"type": "markdown",
"key": "notes",
"label": "Notes",
"rows": 4
};
el.value = "## Root cause\n\nThe disk was **full**.";
</script>Properties
Section titled “Properties”| Name | Type | Default | Description |
|---|---|---|---|
uploaderJS | (file: File) => Promise<UploadedFile> | undefined | — | Resolved registry uploader. <baht-form> injects it when field.uploader is set |
allowImageJS | MarkdownImagePolicy | undefined | — | Which image URLs may embed; any other image renders as a link. <baht-form> injects registry.markdownImage |
fieldJS | FieldDescriptor | — | Field spec: { order, type, key, label?, placeholder?, options?, … } |
valueJS | unknown | null | Controlled value. Re-feed on every baht-input |
disabled | boolean | false | Disable the control |
readonly | boolean | false | Read-only |
required | boolean | false | Show required mark |
show-optional | boolean | false | Append the localized "(optional)" marker to the label when not required (set by <baht-form show-optional>). |
errorJS | string | null | null | Validation message to display |
debounce | number | undefined | 150 (BahtFieldBase.defaultDebounce) | Quiet time (ms) before typing reaches the host as baht-input. Blur flushes at once. 0 = every keystroke. <baht-form options.inputDebounce> sets it form-wide |
Events
Section titled “Events”| Event | detail | Description |
|---|---|---|
baht-input | { key, value } | Fired on every user edit |
name | CustomEvent |