Field
1 つのコントロールをラベル、説明、検証状態、エラーメッセージに関連付けます。
デモを読み込み中…
let field = Field::new("email");
field
.root().flex_col().gap(6.0)
.child(field.label_with(text("Email")))
.child(text_input(value))#インポート
quickgui から Field をインポートします。
use quickgui::*;#使い方
let field = Field::new("email");
field
.root().flex_col().gap(6.0)
.child(field.label_with(text("Email")))
.child(text_input(value))#構成
Field::rootField::itemField::labelField::controlField::validityField::descriptionField::error
#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
Field
ソースを見るpub fn new(control_id: impl Into<ElementId>) -> Selfcontrol_idpub const fn control_id(&self) -> ElementId—
root_idpub fn root_id(&self) -> ElementId—
label_idpub fn label_id(&self) -> ElementId—
description_idpub fn description_id(&self) -> ElementId—
error_idpub fn error_id(&self) -> ElementId—
item_idpub fn item_id(&self) -> ElementId—
Stable identity of the item wrapper around one label/control/description row.
pub fn item_id(&self) -> ElementIdソースを見るvalidity_idpub fn validity_id(&self) -> ElementId—
statepub const fn state(&self) -> FieldState—
disabledpub fn disabled(mut self, disabled: bool) -> Self—
invalidpub fn invalid(mut self, invalid: bool) -> Self—
requiredpub fn required(mut self, required: bool) -> Self—
touchedpub fn touched(mut self, touched: bool) -> Self—
dirtypub fn dirty(mut self, dirty: bool) -> Self—
filledpub fn filled(mut self, filled: bool) -> Self—
validation_modepub const fn validation_mode(mut self, mode: FieldValidationMode) -> Self—
Declare when the controlled validity is expected to be recomputed, Base UI's `validationMode`.
pub const fn validation_mode(mut self, mode: FieldValidationMode) -> Selfソースを見るvalidation_debouncepub fn validation_debounce(mut self, debounce: Duration) -> Self—
Wait this long after a change before revalidating, Base UI's `validationDebounceTime`. The interval is an exact one-shot deadline the application schedules with [`crate::AsyncViewContext::sleep`]; QuickGUI never polls, and a field that is not being typed into owns nothing. It applies to [`FieldValidationTrigger::Change`] only — a blur or a submit is a deliberate boundary and validates immediately. Clamped to [`MAX_FIELD_VALIDATION_DEBOUNCE`].
pub fn validation_debounce(mut self, debounce: Duration) -> Selfソースを見るvalidation_mode_valuepub const fn validation_mode_value(&self) -> FieldValidationMode—
Configures validation mode value for this part.
pub const fn validation_mode_value(&self) -> FieldValidationModeソースを見るvalidation_debounce_valuepub const fn validation_debounce_value(&self) -> Duration—
Configures validation debounce value for this part.
pub const fn validation_debounce_value(&self) -> Durationソースを見るshould_validatepub const fn should_validate(&self, trigger: FieldValidationTrigger) -> bool—
Whether the declared mode expects this event to recompute validity. A submit always validates; a blur validates on `OnBlur` and `OnChange`; a change validates only on `OnChange`.
pub const fn should_validate(&self, trigger: FieldValidationTrigger) -> boolソースを見るvalidation_delaypub const fn validation_delay(&self, trigger: FieldValidationTrigger) -> Option<Duration>—
How long to wait before recomputing validity for this event, when it validates at all. Returns `None` when the declared mode ignores the event, and `Some(Duration::ZERO)` when it validates immediately, so a listener can branch once instead of re-deriving the policy.
pub const fn validation_delay(&self, trigger: FieldValidationTrigger) -> Option<Duration>ソースを見るvalidation_messagepub fn validation_message(mut self, message: impl Into<Arc<str>>) -> Self—
Retain the message used by form reports and native accessibility. The visible error part remains application-owned and can use different presentation copy.
pub fn validation_message(mut self, message: impl Into<Arc<str>>) -> Selfソースを見るvalidation_message_textpub fn validation_message_text(&self) -> Option<&str>—
Configures validation message text for this part.
pub fn validation_message_text(&self) -> Option<&str>ソースを見るvalidation_message_is_truncatedpub const fn validation_message_is_truncated(&self) -> bool—
Configures validation message is truncated for this part.
pub const fn validation_message_is_truncated(&self) -> boolソースを見るField::root_with
ソースを見るpub fn root_with(&self, root: Element) -> ElementDecorate an application-owned structural root without adding role or appearance.
Field::root
ソースを見るpub fn root(&self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
Field::label_with
ソースを見るpub fn label_with(&self, label: Element) -> ElementDecorate a visible label and give it native label-to-control activation. Use [`Self::passive_label_with`] for button-like controls whose label should name but not activate them.
Field::label
ソースを見るpub fn label(&self) -> ElementCreate the unstyled label part. Use [`Self::label_with`] to supply an existing element.
Field::passive_label_with
ソースを見るpub fn passive_label_with(&self, label: Element) -> ElementDecorate a label relationship without forwarding pointer activation to the control.
Field::passive_label
ソースを見るpub fn passive_label(&self) -> ElementCreate the unstyled passive label part. Use [`Self::passive_label_with`] to supply an existing element.
Field::control_with
ソースを見るpub fn control_with(&self, control: Element) -> ElementDecorate the application-owned control with field state and mounted relationships.
Field::control
ソースを見るpub fn control(&self) -> ElementCreate the unstyled control part. Use [`Self::control_with`] to supply an existing element.
Field::item_with
ソースを見るpub fn item_with(&self, item: Element) -> ElementDecorate the caller-owned wrapper around one label/control/description row. Base UI's Field.Item groups the parts of a single field inside a larger fieldset so the row can be styled and laid out as one unit. QuickGUI supplies the stable identity and propagates the field's disabled state; layout and appearance stay application-owned.
Field::item
ソースを見るpub fn item(&self) -> ElementCreate the unstyled item part. Use [`Self::item_with`] to supply an existing element.
Field::validity_with
ソースを見るpub fn validity_with(&self, visible: bool, validity: Element) -> ElementDecorate a caller-owned part that is shown only for a chosen validity, Base UI's Field.Validity. `visible` is the application's own predicate over [`Self::state`] — "invalid and touched", "valid and dirty", whatever the product means. QuickGUI removes the part from layout, paint, input, and the accessibility tree when the predicate is false, exactly as [`Self::error_with`] does, so an unmatched validity costs nothing.
Field::validity
ソースを見るpub fn validity(&self, visible: bool) -> ElementCreate the unstyled validity part. Use [`Self::validity_with`] to supply an existing element.
Field::description_with
ソースを見るpub fn description_with(&self, description: Element) -> ElementDecorate visible supplementary help for the control.
Field::description
ソースを見るpub fn description(&self) -> ElementCreate the unstyled description part. Use [`Self::description_with`] to supply an existing element.
Field::error_with
ソースを見るpub fn error_with(&self, error: Element) -> ElementDecorate a visible error and remove it from layout while the controlled field is valid.
Field::error
ソースを見るpub fn error(&self) -> ElementCreate the unstyled error part. Use [`Self::error_with`] to supply an existing element.
