Page History
...
- authorizationDisable – Specifies a policy set that determines when the component should be disabled based on user permissions. For example, setting to "readOnlyPolicy" will disable the code editor for users who don’t have edit permissions according to the specified policy.
Guidelines
Usage
- Set
defaultLanguageto the expected syntax so highlighting is predictable when automatic detection fails (e.g.,json,yaml,nginx,plaintext). - Seed helpful starter content with
defaultValue(e.g., a minimal valid JSON object) to reduce user errors. - Enforce input rules with
validation(userequired,minLength,maxLength, andpatternfor syntax/shape checks).
Sizing & Layout
- Set
heightto a fixed px value for consistent editing space (e.g.,400px) or a percentage for flexible layouts (e.g.,100%within its container). - Choose
theme(DarkorLight) to maintain comfortable contrast in the expected environment; prefer the option that meets contrast needs of surrounding UI.
States & Feedback
- Use
readonlyto present code without allowing edits. - Use
authorizationDisableto disable editing based on policy while keeping the control present. - Toggle
hiddento remove the control from view when not applicable.
Data-Driven / Conditional Behavior
- Constrain content shape with
validation.pattern(regex) and size withminLength/maxLength; require presence withrequired. - Preserve draft stability across sessions with
saveInLocalStorage.
Content & Localization
- Provide clear starter content with
defaultValuethat matchesdefaultLanguage. - Prefer language-neutral examples in
defaultValue, since the component exposes no text translation settings.
Dos & Don’ts
| Do | Don’t | Article setting(s) |
|---|---|---|
Set defaultLanguage to the expected syntax so highlighting is stable. | Rely solely on auto-detection and accept mismatched highlighting. | defaultLanguage |
| Pre-fill a minimal valid template. | Start empty when strict formatting is required. | defaultValue |
| Persist drafts between sessions. | Risk data loss on reloads. | saveInLocalStorage |
| Enforce rules with validation. | Depend on user memory for format rules. | validation.required, validation.minLength, validation.maxLength, validation.pattern |
| Disable edits for review or policy. | Leave the editor editable when changes aren’t allowed. | readonly, authorizationDisable |
| Give users enough vertical space to work. | Force excessive scrolling with a tiny viewport. | height |
| Choose a theme for readable contrast. | Switch themes arbitrarily mid-task. | theme |
...