Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Buttons

  • Button
  • ShimmerButton
  • InteractiveHoverButton
  • RainbowButton
  • PulsatingButton
  • RippleButton
  • ButtonGroup
  • SocialButton

Basic Inputs

  • Input
  • Textarea
  • CellEditor
  • Select
  • Checkbox
  • CheckboxGroup
  • Radio
  • Switch
  • Toggle
  • Segmented
  • Slider
  • NumberField
  • ElasticSlider

Advanced Inputs

  • MathTextarea
  • QuestionEditor
  • QuestionAnswer
  • MathField
  • SecretField
  • PasswordGenerator
  • Combobox
  • RemoteSelect
  • Listbox
  • Mentions
  • InputOTP
  • Rating
  • Upload
  • RegionSelect
  • ImageCropper
  • ScopeMatrix
  • Transfer
  • Cascader
  • TreeSelect
  • RegionCascader
  • CountrySelect
  • MarkdownEditor
  • Novel editor
  • RichTextEditor
  • CodeEditor
  • IssueReporter
  • ColorPicker
  • ColorField
  • ColorSwatchPicker
  • Choicebox
  • EmojiPicker
  • VoiceRecord
  • IconPicker
  • InspectorPanel

Date and Time

  • Calendar
  • DatePicker
  • DateTimePicker
  • DateRangePicker
  • TimePicker
  • TimeField

Form Frameworks

  • Form
  • ModalForm / DrawerForm
  • ProForm
  • StepsForm
  • LoginForm
  • AuthPanel
  • ClickCaptcha
  • Label
  • Field
  • SearchForm

MarkdownEditor

markdown-editor

Edits Markdown through a WYSIWYG TipTap surface with Markdown input and output.

Usage

Basic usage

Uncontrolled writing method, use defaultValue to fill in the initial markdown, with its own toolbar.

tsx
<MarkdownEditor defaultValue="# Title\n\nText Paragraph" className="w-[32rem]" />

Placeholder + line height

placeholder prompts empty state, minRows controls the minimum height of the content area.

tsx
<MarkdownEditor placeholder="Write something..." minRows={3} className="w-[32rem]" />

Inside a Field

Works with Field, invalid triggers the danger shell, and name bridges the native form.

Details are required
tsx
<Field label="Order details (required)" error="Details cannot be empty" className="w-[32rem]">
  <MarkdownEditor name="detail" invalid placeholder="Required" />
</Field>

Disabled

disabled Hide the toolbar and lock editing, and reduce the overall transparency.

tsx
<MarkdownEditor disabled defaultValue="# Read-only content" className="w-[32rem]" />

When to use

Use MarkdownEditor to edit long-form content such as order notes, articles, or formatted descriptions while storing the result as a Markdown string. Set name to bridge the value into a native form or Field. Use Input for short plain text, or Mentions when the only advanced requirement is @-mentions.

Import

ts
import { MarkdownEditor } from "@hulianui/ui"

Props

NameTypeDefaultDescription
valuestring-Controlled markdown string
defaultValuestring-Initial value when uncontrolled.
namestring-Name of the hidden input used to bridge native forms and Field.
placeholderstring-Placeholder shown when the editor is empty.
invalidbooleanfalseApplies the danger style; an enclosing Field may also drive this through data-invalid.
disabledbooleanfalseDisables editing.
minRowsnumber6Content area minimum height (rows)
classNamestring-Additional class name for the editor shell.
aria-labelstringConfigProvider localeAccessible name for the editor. An explicit value takes precedence over the locale.

Events

EventTypeDescription
onChange(markdown: string) => voidContent change callback, parameter is markdown string

Localization

The editor and formatting-toolbar accessible names, every formatting action,
and the link URL prompt follow the nearest ConfigProvider locale. An explicit
aria-label takes precedence. A legacy custom locale without
components.markdownEditor keeps the original Chinese compatibility labels.

Example

tsx
// Controlled
const [md, setMd] = useState("# Title");
<MarkdownEditor value={md} onChange={setMd} />

// Field bridge: the hidden input carries form values and validation state
<Field label="Order details (required)" error="Details cannot be empty" className="w-[32rem]">
  <MarkdownEditor name="detail" invalid placeholder="Required" />
</Field>

Usage guidelines

  • Values enter and leave as Markdown strings, not TipTap document JSON. Do not pass TipTap's internal rich-text structure as value.
  • Inside Field, either pass invalid directly or let the enclosing Field drive data-invalid; setting both is unnecessary.

Related

SecretField · Combobox · Listbox · Mentions · InputOTP · Rating

Playground

<MarkdownEditor placeholder="Enter markdown..." minRows={6} />
PreviousCountrySelectFormsNextNovel editor

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Localization
    • Example
    • Usage guidelines
    • Related
  • Playground