flutter_declarative_mdx (pre-release)
Version 1.0.0 is imminent, until version 1.0.0 is available we recommend you don't use this package in any production systems. All versions before v1.0.0 may have breaking changes.
A Flutter library for rendering Extensible Markdown (MDX) as native UI.
flutter_declarative_mdx enables server-driven pages, forms, documents, and workflows to be defined using structured markdown and rendered directly inside a Flutter app.
The goal is simple: make it easy to describe common app UI declaratively and deliver it from a server without rebuilding the app.
Documentation
https://cosella-consulting.github.io/flutter_declarative_mdx/
What it does
The library renders MDX documents into Flutter widgets and allows custom components to be registered and composed.
Typical use cases:
- Content and document rendering
- Forms and data capture
- Step-by-step workflows
- Server-driven pages
- Rich text with embedded components
Read more about the Problem space and Vision for this library.
Installation
Add to pubspec.yaml:
dependencies:
flutter_declarative_mdx: <latest_version>
Run:
flutter pub get
Basic usage
DeclarativeMdxView(
document: mdxString,
)
Example MDX:
# Profile
<Form>
<TextField name="firstName" label="First name" />
<TextField name="lastName" label="Last name" />
<Button action="submit">Continue</Button>
</Form>
Extending with custom components
Custom components can be registered and rendered from MDX:
DeclarativeMdx.registerComponent(
'MyComponent',
(context, node) => MyWidget(),
);
This allows integration with your own design system and domain widgets.
Contributing
Contributions are welcome.
If you’d like to help:
- Fork the repository
- Create a branch
- Make your change
- Open a pull request
Please keep changes focused and include documentation updates where useful.
Issues and discussions are also welcome for:
- Bugs
- Feature requests
- Design questions
- Real-world usage feedback
Status
This project is evolving and APIs may change. Feedback and collaboration are encouraged.
Acknowledgements
flutter_declarative_mdx builds on the work of several excellent open-source libraries in the Flutter ecosystem:
- Flutter — the underlying UI framework.
- flutter_hooks — functional widget patterns inspired by React Hooks.
- provider — simple and pragmatic state management.
- markdown_widget — Markdown rendering foundation extended by this project.
- google_fonts — font integration and typography support.
The maintainers and contributors of these projects make libraries like this possible.
License
See LICENSE file in this repository.
Libraries
- declarative_mdx
- declarative_mdx_configuration
- hooks/use_actions
- hooks/use_configure_workflow
- hooks/use_current_page
- hooks/use_current_step
- hooks/use_customizations_provider
- hooks/use_model
- hooks/use_model_state_provider
- hooks/use_page_status
- hooks/use_steps
- hooks/use_workflow_provider
- layout/extensible_markdown/custom_node
- layout/extensible_markdown/default_tag_handlers/select_tag_handler
- layout/extensible_markdown/default_tag_handlers/submit_model_tag_handler
- layout/extensible_markdown/default_tag_handlers/text_field_tag_handler
- layout/extensible_markdown/tag_handler
- layout/layout_content
- layout/layout_header
- layout/layout_page
- layout/layout_workflow
- model/customizations
- model/styled_typography
- model/workflow
- model/workflow_action
- model/workflow_page
- model/workflow_page_status
- model/workflow_page_style
- model/workflow_status
- model/workflow_step
- model/workflow_step_info
- model/workflow_step_style
- providers/customizations_provider
- providers/model_state_provider
- providers/workflow_provider
- utilities/map_dynamic_to_list_of_typed_objects