pub struct CodeEditorProps {
pub value: String,
pub language: Language,
pub theme: CodeTheme,
pub line_numbers: bool,
pub read_only: bool,
pub spellcheck: bool,
pub aria_label: String,
pub placeholder: String,
pub class: String,
pub oninput: EventHandler<String>,
}Expand description
Props for CodeEditor.
use dioxus_code::{CodeTheme, Theme};
use dioxus_code_editor::{CodeEditorProps, Language};
let _props = CodeEditorProps::builder()
.value("fn main() {}")
.language(Language::Rust)
.theme(CodeTheme::fixed(Theme::TOKYO_NIGHT))
.build();Fields§
§value: StringThe current editor contents.
language: LanguageTree-sitter grammar used for syntax highlighting.
Pass a Language variant directly. Use Language::from_slug to
turn a runtime slug into a variant. Defaults to Language::Rust.
theme: CodeThemeSyntax theme selection shared with dioxus-code.
line_numbers: boolShow a gutter with one-based line numbers.
read_only: boolDisable editing while preserving syntax highlighting and text selection.
spellcheck: boolForward spellcheck to the textarea input layer.
aria_label: StringAccessible label for the editor textbox.
placeholder: StringPlaceholder shown only while CodeEditorProps::value is empty.
class: StringExtra class names appended to the editor root.
oninput: EventHandler<String>Called with the full editor text after each input event.
Implementations§
Source§impl CodeEditorProps
impl CodeEditorProps
Sourcepub fn builder() -> CodeEditorPropsBuilder<((), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> CodeEditorPropsBuilder<((), (), (), (), (), (), (), (), (), ())>
Create a builder for building CodeEditorProps.
On the builder, call .value(...), .language(...)(optional), .theme(...)(optional), .line_numbers(...)(optional), .read_only(...)(optional), .spellcheck(...)(optional), .aria_label(...)(optional), .placeholder(...)(optional), .class(...)(optional), .oninput(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of CodeEditorProps.
Trait Implementations§
Source§impl Clone for CodeEditorProps
impl Clone for CodeEditorProps
Source§fn clone(&self) -> CodeEditorProps
fn clone(&self) -> CodeEditorProps
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl PartialEq for CodeEditorProps
impl PartialEq for CodeEditorProps
Source§fn eq(&self, other: &CodeEditorProps) -> bool
fn eq(&self, other: &CodeEditorProps) -> bool
self and other values to be equal, and is used by ==.