Directory
- Welcome
Rich Text Component
The RichText component provides a full-featured text editor powered by Quill.js. It offers rich text formatting capabilities, form integration, and customizable styling options.
Key Features
-
Rich Text Editing: Full text formatting capabilities
-
Quill.js Integration: Industry-standard editor framework
-
Form Integration: Seamless form compatibility
-
Accessibility: ARIA support and keyboard navigation
Basic Usage
Create a simple rich text editor:
<RichText class="h-48" />
Rich Text Component Props API
Prop | Type | Default | Description |
---|---|---|---|
label | string | Label text for the editor | |
subLabel | string | Secondary descriptive text | |
required | boolean | false | Makes the field required |
disabled | boolean | false | Disables the editor |
variant | 'default' | 'underline' | default | Visual style variant |
wrapperProps | HTMLAttributes <div> | Additional props for the wrapper |
Rich Text Functions API
The RichText component exposes the Quill.js instance for programmatic control:
const editor = await ready(document.querySelector<RichTextElement>('rich-text'));
const quill = editor.quill;
// Set contentquill.setText('Hello, World!');
// Get contentconst content = quill.getContents();
// Format textquill.formatText(0, 5, 'bold', true);
Best Practices
Common Use Cases
Limited Time Launch Sale
Create professional content editing experiences with our pre-built RichText component. Get the AstroJS starter template now!
GET 60% OFF!