redraw/attribute
Types
Constants
Functions
pub fn accept_charset(types: List(String)) -> Attribute
pub fn access_key(value: String) -> Attribute
pub fn aria(key: String, value: String) -> Attribute
Set aria attribute on the node. Should be used like aria("valuenow", "75")
.
pub fn auto_capitalize(value: String) -> Attribute
pub fn autocomplete(name: String) -> Attribute
pub fn content_editable(value: Bool) -> Attribute
If true, the browser lets the user edit the rendered element directly.
This is used to implement rich text input libraries like Lexical. React
warns if you try to pass React children to an element with
content_editable(True)
because React will not be able to update its content
after user edits.
pub fn dangerously_set_inner_html(
inner_html: InnerHTML,
) -> Attribute
Overrides the innerHTML property of the DOM node and displays the passed HTML inside. This should be used with extreme caution! If the HTML inside isn’t trusted (for example, if it’s based on user data), you risk introducing an XSS vulnerability.
pub fn data(key: String, value: String) -> Attribute
Data attributes let you attach some string data to the element, for example
data("fruit", "banana")
. In React, they are not commonly used because you
would usually read data from props or state instead.
pub fn draggable(value: Bool) -> Attribute
Specifies whether the element is draggable. Part of HTML Drag and Drop API.
pub fn enter_key_hint(value: String) -> Attribute
Specifies which action to present for the enter key on virtual keyboards.
pub fn form_action(action: String) -> Attribute
pub fn form_enctype(value: String) -> Attribute
pub fn form_method(method: String) -> Attribute
pub fn form_novalidate(value: Bool) -> Attribute
pub fn form_target(target: String) -> Attribute
pub fn id(value: String) -> Attribute
Specifies a unique identifier for this element, which can be used to find it later or connect it with other elements. Generate it with useId to avoid clashes between multiple instances of the same component.
pub fn inner_html(html: String) -> InnerHTML
The inner_html
data should be created as close to where the HTML is
generated as possible. This ensures that all raw HTML being used in your
code is explicitly marked as such, and that only variables that you expect
to contain HTML are passed to dangerously_set_inner_html
. It is not
recommended to create the object inline like
html.div([attribute.dangerously_set_inner_html(attribute.inner_html(markup))], [])
pub fn input_mode(value: String) -> Attribute
Specifies what kind of keyboard to display (for example, text, number or telephone).
pub fn is(value: String) -> Attribute
If specified, the component will behave like a custom element.
pub fn item_prop(value: String) -> Attribute
Specifies which property the element represents for structured data crawlers.
pub fn novalidate(value: Bool) -> Attribute
pub fn placeholder(text: String) -> Attribute
pub fn ref(ref: Ref(Option(a))) -> Attribute
A ref object from redraw.use_ref
. Your ref will be filled with the DOM
element for this node. Contrarily to JS React, when using a Ref, you’re
forced to use an optional type here. Because when using this function, you
want to get a reference from a real DOM node, meaning at the initialization
of the reference, you won’t have any data. Use ref_
when you want full
control over the ref you send to the Component.
pub fn ref_(ref: fn(a) -> Nil) -> Attribute
A ref callback function. The callback will be provided with the DOM element for this node. Use this function to get control on the ref provided by the DOM node or the component.
pub fn role(value: String) -> Attribute
Specifies the element role explicitly for assistive technologies.
pub fn spell_check(value: Bool) -> Attribute
If explicitly set to true or false, enables or disables spellchecking.
pub fn suppress_content_editable_warning(
value: Bool,
) -> Attribute
pub fn suppress_hydration_warning(value: Bool) -> Attribute
pub fn tab_index(value: Int) -> Attribute
Overrides the default Tab button behavior. Avoid using values other than -1 and 0.
pub fn translate(value: Translate) -> Attribute
Passing No excludes the element content from being translated.