Forms & filters
Calm, roomy controls: white inputs with soft corners, a visible label on every field and an orange focus ring. Ask only for what you need, and say why.
Field
Every control sits in a .field: a <label> tied to the input with for/id, the .input, and an optional .hint linked with aria-describedby. Stack fields with .fstack; put two short fields side by side with .frow (it stacks below 700px).
- A visible label on every field; mark required fields with
*andrequired. - Set
type,autocompleteandinputmodeso phones show the right keyboard and browsers can fill it. - Use hints to explain why you ask.
- Use
disabledfor values that can't be changed here;.input:disabledgreys them out.
- Placeholder text as the only label.
- Ask for data you don't need; every field with personal data needs a purpose (see
data-compliance).
Errors
The site reports validation as a summary above the form: .reg-errors with role="alert" and one list item per problem, plus a toast for same-request errors. There is no per-field error style. Write each message as what went wrong and how to fix it.
- That code was incorrect or has expired. Please try again.
- Enter a contact email, for example you@company.com.
- Keep the values people typed when you return the form.
- Use
asp-validation-summary="All" class="reg-errors"or loopModel.Errorsinto the list.
- Errors that only say "Invalid".
- Colour as the only signal of an error.
Select
A native <select class="input"> inside .select-wrap, which draws the chevron. Use it for five or more options or for long lists such as country and timezone; use radios or a segmented control for two to four.
- Start with an empty "Select a ..." or "All ..." option when nothing is chosen yet.
- A select without
.select-wrap:select.inputremoves the native arrow. - Custom JavaScript dropdowns for plain choices.
Textarea
textarea.input for plain multi-line text. It resizes vertically and starts at 120px. Say the limit in the hint and set maxlength to match.
Optional, up to 1,000 characters.
Checkbox & radio
.choice hides the native input and draws an orange box after it, so keep the <input> directly before .box. Add .round for radios and .choice-block with .choice-text when each option needs a title and a description. Group related options in fieldset.field with a legend, or a role="radiogroup" with a label.
| Class | Use for |
|---|---|
.choice + .box | Checkbox. Put ✓ in the box. |
.box.round | Radio. Leave the box empty. |
.choice-block + .choice-text | Options with a description, such as settings and opt-ins. |
.choice-disabled | Locked option; also set disabled on the input. |
.choice-row | Short options in one wrapping row. |
- Wrap the whole option in the
<label>so the text is clickable. - Leave marketing and newsletter opt-ins unchecked by default.
- Remove the input or move it after
.box; the checked and focus styles depend on it. - A checkbox for an instant on/off setting; use a toggle.
Consent checkbox
.checkbox is a native checkbox with wrapped text, for consent lines that carry a link to a policy. It is never pre-ticked: consent must be an active opt-in.
- Say exactly what people agree to, and link the policy.
- One consent per purpose (newsletter, sponsor sharing).
- Pre-tick consent or bundle it with the terms.
Terms acceptance
.terms-accept shows authored terms in a scrollable, keyboard-focusable .terms-accept-body, followed by a .checkbox the person must tick before the action. Use it when an action needs agreement to specific terms, such as creating an event on a calendar with its own rules.
Events on AgentCon follow these terms. Read them before you create your event.
Running your event
- Keep the event free for attendees.
- Follow the Global AI Community code of conduct.
Share photos and a short report within two weeks of the event.
- Render authored Markdown through the sanitizer and keep a copy of the accepted version.
- Require the checkbox and check it again on the server.
- Pre-tick the checkbox or hide the terms behind a link only.
- Use it for marketing consent; use the consent checkbox.
Toggle
A switch for a setting that is simply on or off. The label says what "on" means. It is a real checkbox underneath, so it submits with the form and works with the keyboard.
- Write the label as the "on" state.
- Keep the
<input>directly before.switch.
- A toggle for consent or for a choice between two named options (use a segmented control).
Segmented control
Two to four mutually exclusive options shown at once, built from radios so it works without JavaScript. Use it for compact settings such as profile visibility.
Members only means signed-in members. Private hides your whole profile.
- Label the group with
role="radiogroup"andaria-labelledby. - Short labels, one or two words.
- Use it as tabs or navigation; it is a form value.
- More than four options; use a select.
Rating
A 1 to 5 score built from radios, so it works without JavaScript: each number is a square button and the chosen one fills with --orange-deep. Used for event evaluations and course feedback. Keep each <input> directly before its <label>.
- Say what 1 and 5 mean in a hint.
- Mark the saved value
checkedon the server.
- Use it for named options; use a segmented control or select.
- Build a second rating style such as stars.
Filter bar
The white bar in a list page's header band: a pill search input plus format chips (/events) or selects (/chapters). Filtering happens instantly on the client, so there is no submit button. Inside the bar, inputs become cream pills automatically.
- Give the search and every select an
aria-label; there is no visible label. - Exactly one
.fmt-chip.activeat a time. - Show an empty state when nothing matches.
- Use
.fmt-chipoutside a filter bar, or use.chip(a label) as a filter. - Put more than one search in a bar.
Newsletter
The pill input and button combo for Global AI Weekly, with a .sub-note proof line. Anonymous visitors subscribe through the form below, which opens in a modal from the Subscribe button; signed-in members get a one-click confirm instead.
156 issues and counting · no spam, unsubscribe anytime
Subscribe form
- Require the consent checkbox and protect the form with Turnstile.
- Use
.newsletter-rowinside.weekly-subscribe-formwhen input and button share a row; it stacks on phones.
- Send an address to the mailing provider straight from the browser; it goes through our backend.
Autocomplete
A search input that lists matches in a .suggest panel below it, used for venue and city lookup (OpenStreetMap via Photon). It follows the ARIA combobox pattern: arrow keys move the highlight, Enter picks, and a live status line announces the result count. Click a result to pick it.
Location search and map: © OpenStreetMap contributors
- Wait for three characters before searching, and cancel the previous request.
- Show the OpenStreetMap attribution whenever results or a map are visible.
- Use it for a fixed list; use a select.
- Call a third-party geocoder from the browser; requests go through
/my/location-search.
Code input
Six single-digit boxes for the passwordless sign-in code. The script moves focus forward as you type, back on Backspace, fills every box on paste and keeps a hidden code field in sync for the POST. Try typing or pasting a code.
- Put
autocomplete="one-time-code"on the first box so phones can fill the code. - Label each box ("Digit 1" to "Digit 6").
- Use the boxes for anything but one-time codes.
Rich text editor
A constrained editor for organizer-written descriptions: paragraphs, h3, bold, italic, bulleted lists and links, nothing else. Pasted content is cleaned and the HTML is sanitised again on the server. It works here; select some text and use the toolbar.
AgentCon London is a free, full day of talks and labs about building AI agents, hosted by Global AI London at LSBU.
What you'll do
- Build an agent in a hands-on lab
- Meet the people building with AI in London
- Render it with the
_RichTextEditorpartial and its_RichTextLinkModal. - Sanitise on the server (
SafeHtml.EventDescription) whatever the client sends.
- Add toolbar commands without updating the sanitiser.
- Use it for short fields; use a textarea.
Country & timezone
Two shared dropdowns that must behave the same everywhere. Both are a normal .select-wrap select; the rules are about where the options come from and how the value is chosen.
| Dropdown | Rules |
|---|---|
| Country | Always a select, never free text, filled by the shared partial Views/My/_CountryOptions.cshtml with new CountrySelection(savedValue), so the saved value is selected on the server. One list of common English names (Services/Countries.cs: "United States", "South Korea"); convert names from ISO 3166, OpenStreetMap or older records with Countries.Normalize or Countries.FromIsoCode. |
| Timezone | Options from TimezoneHelper.GetIanaTimezones(current); the stored value is the IANA id, marked selected on the server (edit forms need no script). Only where nothing is saved yet, such as onboarding, a script preselects the browser timezone when the select is empty. |
- Pass the saved value to
GetIanaTimezonesso it stays selectable. - Show the DST-aware offset labels the helper produces.
- Build a timezone list from
TimeZoneInfo.GetSystemTimeZones(). - Store Windows ids or numeric offsets.
- Build a second country list, or preselect a country with a
data-selectedscript; a test fails on both.
Photo upload & crop
Profile photos use the .file-dropzone: a dashed drop area that also opens the file picker when clicked. Choosing or dropping a photo opens a crop step in a modal, where the member drags the photo inside a round guide and zooms by pinching, with the slider, the mouse wheel or +/- (arrow keys move it). HEIC photos are accepted where the browser can open them (Safari); elsewhere members are asked for a JPEG or PNG. Only the cropped 800px square is uploaded, as a JPEG, in place: the page does not reload, so unsaved changes in the rest of the form are kept.
| Part | Use |
|---|---|
.file-dropzone + __zone | The drop area: a <label for> around the current photo, an upload icon and a __hint. .is-dragover on the form highlights it while a file is dragged over, and .is-uploading dims it while the photo uploads. |
.file-dropzone--compact | For profile photos: tighter padding, and the icon and hint sit on one line in a .file-dropzone__cta under the photo. |
.file-dropzone__logo + [data-file-dropzone] | For logos submitted with a larger form (partner profiles): the current logo keeps its shape inside a compact zone. Add data-file-dropzone to the wrapper, data-file-dropzone-input to the input and data-file-dropzone-preview to the image; js/framework/file-dropzone.js accepts a dropped file and previews it, and the file uploads when the form is saved. |
.file-dropzone__input | The file input, hidden visually but still reachable with Tab; its focus ring shows on the zone. Don't hide it with .d-none, which removes it from the keyboard. |
Views/My/_PhotoCropModal.cshtml | The crop modal (.photo-crop-frame, a <canvas> and the .photo-crop-zoom slider). Render it once next to a [data-direct-photo-upload] block; my-profile.js opens it with gaicModal and uploads with X-Requested-With: fetch, so the endpoint answers { url } or { error }. |
- Confirm the result with a toast (
window.gaicToast: "Profile photo saved." or the error), and mark the zone.is-uploadingwhile it uploads. - Keep the redirect fallback on the endpoint for requests without the fetch header.
- Auto-submit a separate photo form; it reloads the page and loses unsaved details.
- Use the crop step for logos or banners; it is for round profile photos.