pub fn field_html(
field: &Field<'_>,
filling: &Filling<'_>,
opts: &Emit,
) -> StringExpand description
One field, as the group the app drops into its form.
The shape is goingson’s, down to the class names, so adoption there deletes
renderFormField rather than restyling anything. That is also why the class
names are not emitted by crate::stylesheet: .form-group, .form-label,
.form-hint and .form-error are the apps’ own, and phase A deliberately
emits only what it can generate from the description. Whether they should
move into the description is the next question this raises, not one it
answers.
A FieldKind::Hidden field is the input alone: no group, no label, and
nothing drawn, which is what FieldKind::visible means.
The error marks the group as well as the control. That is
Field::invalid’s own reasoning: a renderer with no descendant selectors
cannot find the group from the message, so the group has to be told.
use makeover_layout::{Field, FieldKind};
use makeover_webview::{Emit, form::{Filling, Value, field_html}};
let field = Field::new(FieldKind::Text, "title", "Title");
let html = field_html(&field, &Filling::of(Value::Text("Ship it")), &Emit::default());
assert!(html.contains(r#"<label class="form-label" for="title">Title</label>"#));
assert!(html.contains(r#"value="Ship it""#));