euv_core/vdom/attribute/enum.rs
1use crate::*;
2
3/// Represents the name of an HTML attribute or DOM property.
4///
5/// Covers common HTML attributes, accessibility attributes, and custom data attributes.
6#[derive(Clone)]
7pub enum Attribute {
8 /// The accesskey attribute.
9 AccessKey,
10 /// The action attribute for forms.
11 Action,
12 /// The alt attribute for images.
13 Alt,
14 /// The aria-label accessibility attribute.
15 AriaLabel,
16 /// The autocomplete attribute.
17 AutoComplete,
18 /// The autofocus attribute.
19 AutoFocus,
20 /// The checked attribute for checkboxes/radios.
21 Checked,
22 /// The class attribute.
23 Class,
24 /// The cols attribute for textareas.
25 Cols,
26 /// The contenteditable attribute.
27 ContentEditable,
28 /// The data-* custom attribute.
29 Data(String),
30 /// The dir attribute.
31 Dir,
32 /// The disabled attribute.
33 Disabled,
34 /// The draggable attribute.
35 Draggable,
36 /// The enctype attribute for forms.
37 EncType,
38 /// The for attribute for labels.
39 For,
40 /// The form attribute.
41 Form,
42 /// The height attribute.
43 Height,
44 /// The hidden attribute.
45 Hidden,
46 /// The href attribute for links.
47 Href,
48 /// The id attribute.
49 Id,
50 /// The lang attribute.
51 Lang,
52 /// The max attribute.
53 Max,
54 /// The maxlength attribute.
55 MaxLength,
56 /// The method attribute for forms.
57 Method,
58 /// The min attribute.
59 Min,
60 /// The minlength attribute.
61 MinLength,
62 /// The multiple attribute for selects.
63 Multiple,
64 /// The name attribute.
65 Name,
66 /// The pattern attribute for inputs.
67 Pattern,
68 /// The placeholder attribute.
69 Placeholder,
70 /// The readonly attribute.
71 ReadOnly,
72 /// The required attribute.
73 Required,
74 /// The rows attribute for textareas.
75 Rows,
76 /// The selected attribute for options.
77 Selected,
78 /// The size attribute.
79 Size,
80 /// The spellcheck attribute.
81 SpellCheck,
82 /// The src attribute for media/images.
83 Src,
84 /// The step attribute.
85 Step,
86 /// The style attribute.
87 Style,
88 /// The tabindex attribute.
89 TabIndex,
90 /// The target attribute for links/forms.
91 Target,
92 /// The title attribute.
93 Title,
94 /// The type attribute for inputs.
95 Type,
96 /// The value attribute.
97 Value,
98 /// The width attribute.
99 Width,
100 /// A custom attribute with an arbitrary name.
101 Other(String),
102}
103
104/// Represents the value of an HTML attribute.
105///
106/// Attributes can be static text, reactive signals, event handlers, dynamic expressions,
107/// or CSS class references.
108#[derive(Clone)]
109pub enum AttributeValue {
110 /// A static string value.
111 Text(String),
112 /// A dynamic signal-backed value.
113 Signal(Signal<String>),
114 /// An event handler callback.
115 Event(NativeEventHandler),
116 /// A dynamic expression value of any type (for component props).
117 Dynamic(String),
118 /// A CSS class reference created by the `class!` macro.
119 Css(CssClass),
120}