#[non_exhaustive]pub enum Autocomplete {
Show 39 variants
Off,
Name,
Email,
Username,
CurrentPassword,
NewPassword,
OneTimeCode,
GivenName,
AdditionalName,
FamilyName,
HonorificPrefix,
Nickname,
Organization,
OrganizationTitle,
StreetAddress,
AddressLine1,
AddressLine2,
AddressLine3,
AddressLevel1,
AddressLevel2,
AddressLevel3,
PostalCode,
Country,
CountryCode,
CcName,
CcNumber,
CcExp,
CcExpMonth,
CcExpYear,
CcCsc,
Bday,
BdayDay,
BdayMonth,
BdayYear,
Sex,
Language,
Tel,
TelNational,
Url,
}Expand description
What a TextField holds, as autocomplete names it for the browser
and for WCAG 1.3.5.
The variants are the WHATWG autofill field names a sign-up form and a checkout ask for. A form that asks for a shipping and a billing address on one page has no way here to mark which is which.
use hypersig::Signals;
use hypersig_ui::{Autocomplete, TextField};
use serde::{Deserialize, Serialize};
#[derive(Signals, Serialize, Deserialize)]
struct Address {
city: String,
}
let city = TextField::new("City", Address::city()).autocomplete(Autocomplete::AddressLevel2);
assert!(city.render().render().contains(r#"autocomplete="address-level2""#));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Off
off: the browser offers nothing.
Name
name.
email.
Username
username.
CurrentPassword
current-password.
NewPassword
new-password.
OneTimeCode
one-time-code.
GivenName
given-name: the first name in Western order.
AdditionalName
additional-name: a middle name.
FamilyName
family-name: the last name in Western order.
HonorificPrefix
honorific-prefix, such as “Dr.”.
Nickname
nickname.
Organization
organization.
OrganizationTitle
organization-title: a job title.
StreetAddress
street-address, for a field that takes the whole street address.
AddressLine1
address-line1.
AddressLine2
address-line2.
AddressLine3
address-line3.
AddressLevel1
address-level1: a state, a province, or a prefecture.
AddressLevel2
address-level2: a city or a town.
AddressLevel3
address-level3: a district within a city.
PostalCode
postal-code.
Country
country-name.
CountryCode
country: an ISO 3166-1 alpha-2 country code.
CcName
cc-name: the name on a payment card.
CcNumber
cc-number.
CcExp
cc-exp: the expiry date of a payment card.
CcExpMonth
cc-exp-month.
CcExpYear
cc-exp-year.
CcCsc
cc-csc: the security code of a payment card.
Bday
bday: a birthday.
BdayDay
bday-day.
BdayMonth
bday-month.
BdayYear
bday-year.
Sex
sex: a gender identity, as free text.
Language
language: a preferred language, as a BCP 47 tag.
Tel
tel.
TelNational
tel-national: a phone number without the country code.
Url
url.
Trait Implementations§
Source§impl Clone for Autocomplete
impl Clone for Autocomplete
Source§fn clone(&self) -> Autocomplete
fn clone(&self) -> Autocomplete
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more