Installation
Peer Dependencies
The Angular Material renderer set requires the following peer dependencies:Setup
1. Import the Module
Import theJsonFormsAngularMaterialModule in your Angular module:
2. Import HammerJS
Add HammerJS to yourmain.ts or polyfills.ts:
3. Use in Component
Available Renderers
Control Renderers
Control renderers handle individual form inputs:- BooleanControlRenderer - Checkbox for boolean values
- TextControlRenderer - Text input field
- TextAreaRenderer - Multi-line text input
- NumberControlRenderer - Number input
- DateControlRenderer - Date picker using Angular Material
- RangeControlRenderer - Slider for numeric ranges
- ToggleControlRenderer - Toggle switch for boolean values
- AutocompleteControlRenderer - Autocomplete select for enum values
- ObjectControlRenderer - Nested object structures
Layout Renderers
Layout renderers organize form structure:- VerticalLayoutRenderer - Arranges elements vertically (default)
- HorizontalLayoutRenderer - Arranges elements horizontally
- GroupLayoutRenderer - Groups elements with Material card styling
- ArrayLayoutRenderer - Array layout with add/remove functionality
- CategorizationTabLayoutRenderer - Tab-based categorization using Material tabs
Additional Renderers
- LabelRenderer - Displays label elements
- MasterListComponent - Master-detail view for arrays
- TableRenderer - Array data displayed as a table
Renderer Registry
The package exports theangularMaterialRenderers array which contains all renderer registrations:
Customization
You can customize Angular Material renderers by:- Using Angular Material Theme - Apply your Material theme to style all renderers
- Custom Renderers - Create custom renderer components that extend the Material renderers
- Custom Testers - Override default testers to change when renderers are applied
Example: Custom Theme
Define a custom theme in yourstyles.scss:
Example: Custom Renderer
TypeScript Support
The Angular Material renderer set is written in TypeScript and includes full type definitions.Material Design Icons
The package uses Angular Material icons. Make sure to include the Material Icons font in yourindex.html: