Skip to content

Theme

Inputs

Learn how to style input fields, date and sensitive inputs, checkboxes, radiobuttons, segmented controls, choice pickers, toggles, sliders, steppers and file uploads.

Input Fields

To style an input simply add a .form-control class.

All input fields must either have an associated label or have an aria-label attribute. Optionally, they can have a description text. Use .form-label for labels, and .form-text for input description text. Also, labels can be hidden (but still accessible by screen readers) by adding .visually-hidden class.

You can use layout classes on inputs or on wrapper elements to create custom layouts.

Simple Input

Input help text

View codeHide code
<label for="input-example-1" class="form-label required">Form label</label>
<input type="text" id="input-example-1" class="form-control w-100" placeholder="Input field" required aria-describedby="input-help-1">
<p class="form-text" id="input-help-1">Input help text</p>

Search Input

Use type="search" on the input — the search icon is added automatically

View codeHide code
<label for="input-example-3" class="form-label">Form label</label>
<input type="search" id="input-example-3" class="form-control w-100" placeholder="Search" aria-describedby="input-help-3">
<p class="form-text" id="input-help-3">Use <code>type="search"</code> on the input</p>

Date Input

A date input is type="date" with a calendar icon at the start: wrap the input in a .pos-rel container, add .pl-40 to the input, and place the icon button with .pos-abs.top-8.left-8. The browser shows the date in the person's local format and opens its own date picker. Hide the browser's calendar icon with the CSS, and open the picker from the button with the script: see the CSS and JS tabs in the code below.

Input help text

View codeHide code
<label for="input-date" class="form-label">Start date</label>
<div class="pos-rel">
  <input type="date" id="input-date" class="form-control w-100 pl-40" value="2026-11-11" aria-describedby="input-date-help">
  <button type="button" class="pos-abs pa-0 top-8 left-8" aria-label="Open date picker" tabindex="-1" data-date-picker="input-date">
    <svg class="icon size-24 text-muted" aria-hidden="true"><use href="#common-calendar"/></svg>
  </button>
</div>
<p class="form-text" id="input-date-help">Input help text</p>

Sensitive Input

Use a sensitive input for private data, such as an ID number or an account number. It has a lock icon at the start and hides what people type with type="password". The icon doesn't block clicks, so clicking it focuses the input.

Input help text

View codeHide code
<label for="input-secure" class="form-label">Student ID number</label>
<div class="pos-rel">
  <input type="password" id="input-secure" class="form-control w-100 pl-40" value="A12345678" autocomplete="off" aria-describedby="input-secure-help">
  <svg class="icon size-24 text-muted pos-abs top-8 left-8" aria-hidden="true"><use href="#common-lock"/></svg>
</div>
<p class="form-text" id="input-secure-help">Input help text</p>

Invalid Input

Error description. Add .is-invalid to the input and to the description

View codeHide code
<label for="input-example-4" class="form-label required">Form label</label>
<input type="text" id="input-example-4" class="form-control is-invalid w-100" placeholder="Invalid input" required aria-invalid="true" aria-describedby="input-help-4">
<p class="form-text is-invalid" id="input-help-4">Error description. Add <code>.is-invalid</code> to the input and to the description</p>

Valid Input

Add .is-valid to the input and to the description

View codeHide code
<label for="input-example-5" class="form-label required">Form label</label>
<input type="text" id="input-example-5" class="form-control is-valid w-100" placeholder="Valid input" required aria-describedby="input-help-5">
<p class="form-text is-valid" id="input-help-5">Add <code>.is-valid</code> to the input and to the description</p>

Disabled Input

Input help text

View codeHide code
<label for="input-example-6" class="form-label required">Form label</label>
<input type="text" id="input-example-6" class="form-control w-100" placeholder="Input field" required disabled aria-describedby="input-help-6">
<p class="form-text" id="input-help-6">Input help text</p>

Select

Avoid a select for only two or three options, because people have to open it to see them. If the option is yes or no, use a toggle or a checkbox. If the labels are short, use a segmented control, and if they're longer, use radiobuttons.

View codeHide code
<select class="form-control w-100" aria-label="Example select">
  <option value="option1" selected>Option 1</option>
  <option value="option2">Option 2</option>
  <option value="option3">Option 3</option>
</select>

Checkboxes

Stack checkboxes in a column on small screens and put them in a row from the md breakpoint (680px): .d-flex.flex-column.flex-md-row.flex-wrap.

A checkbox is indeterminate when it stands for a group whose items are only partly selected, e.g. a “Select all” checkbox above a list with some items checked. It shows a dash. There's no HTML attribute for this state: set input.indeterminate = true in your script (see the JS tab). Clicking an indeterminate checkbox checks it.

View codeHide code
<div class="d-flex flex-column flex-md-row flex-wrap gap-x-24 gap-y-8">
  <label class="form-checkbox">
    <input type="checkbox" name="checkbox-name">
    <span class="checkbox mr-8"></span>
    <span>Checkbox label</span>
  </label>
  <label class="form-checkbox">
    <input type="checkbox" name="checkbox-name" checked>
    <span class="checkbox mr-8"></span>
    <span>Checkbox label</span>
  </label>
  <label class="form-checkbox">
    <input type="checkbox" name="checkbox-name" data-indeterminate>
    <span class="checkbox mr-8"></span>
    <span>Indeterminate</span>
  </label>
</div>

Radiobuttons

Stack radiobuttons in a column on small screens and put them in a row from the md breakpoint (680px): .d-flex.flex-column.flex-md-row.flex-wrap. Each label has 8px padding at the top and bottom, so the column needs no gap.

Don't use radiobuttons for a yes or no choice: use a toggle or a checkbox instead.

View codeHide code
<div class="radio-group d-flex flex-column flex-md-row flex-wrap gap-x-24" role="radiogroup" aria-label="Radio group label">
  <label class="form-radio">
    <input type="radio" name="radio-name" value="1">
    <span>Radio label</span>
  </label>
  <label class="form-radio">
    <input type="radio" name="radio-name" value="2">
    <span>Radio label</span>
  </label>
</div>

Radiobuttons with Descriptions

Stack the options with .d-flex.flex-column and put a description under each label: make the label's <span> .d-block and add the description in a <small class="d-block text-md text-quiet">. Use <small>, not another <span>: the radio circle is drawn on every <span> inside the label. The circle stays centered on the label and description together.

Frequency

View codeHide code
<div>
  <p id="frequency-label" class="mb-4">Frequency</p>
  <div class="radio-group d-flex flex-column" role="radiogroup" aria-labelledby="frequency-label">
    <label class="form-radio">
      <input type="radio" name="frequency" value="daily" checked>
      <span class="d-block">Daily digest<small class="d-block text-md text-quiet">Sent at 6 PM, institution time.</small></span>
    </label>
    <label class="form-radio">
      <input type="radio" name="frequency" value="weekly">
      <span class="d-block">Weekly digest<small class="d-block text-md text-quiet">Sent at 6 PM on Fridays, institution time.</small></span>
    </label>
    <label class="form-radio">
      <input type="radio" name="frequency" value="instant">
      <span class="d-block">As matches are found<small class="d-block text-md text-quiet">Batched in 1-hour intervals.</small></span>
    </label>
  </div>
</div>

Segmented Controls

A segmented control is a compact set of radiobuttons for switching between views or options, e.g. grouping a chart by day, week or month. The options sit on a gray track (.d-inline-flex.gap-4.bg-n1.rounded). Each option is a small button: the selected one is .secondary.ba.bg-white with .text-base on its text, the others are .borderless.

Use a segmented control to change how content on the page or in a card is filtered or displayed. Don't use it as tabs that change the content of the whole page: to switch between pages, use Tabs. To let people pick an option, e.g. in a form, use Radiobuttons.

A segmented control doesn't wrap, so use it only for up to three options with short labels. For more options or longer labels, use a select.

One option must always be selected: mark the default one as selected in the markup, and don't leave the control empty.

Use role="radiogroup" and role="radio" with aria-checked. When the selection changes, swap the classes and update aria-checked and tabindex, so the arrow keys move between options like in a native radio group: see the JS tab.

Text

View codeHide code
<div class="d-inline-flex gap-4 bg-n1 rounded" role="radiogroup" aria-label="Group by" data-segmented>
  <button type="button" role="radio" aria-checked="true" class="btn sm secondary ba bg-white"><span class="text-base">Day</span></button>
  <button type="button" role="radio" aria-checked="false" tabindex="-1" class="btn sm borderless"><span>Week</span></button>
  <button type="button" role="radio" aria-checked="false" tabindex="-1" class="btn sm borderless"><span>Month</span></button>
</div>

Icons Only

Icon-only options are 32×32px; the selected one is 1px wider because of its border. Name each one with a <span class="visually-hidden"> placed before the icon (after the icon, the label adds 4px to the button width), so screen readers read "Phone", "Tablet" and "Desktop". Give each one a tooltip with the same name (data-tooltip, see Tooltips).

View codeHide code
<div class="d-inline-flex gap-4 bg-n1 rounded" role="radiogroup" aria-label="Preview size" data-segmented>
  <button type="button" role="radio" aria-checked="false" tabindex="-1" class="btn sm borderless" data-tooltip="Phone"><span class="visually-hidden">Phone</span><svg class="icon" aria-hidden="true"><use href="#common-cellphone"/></svg></button>
  <button type="button" role="radio" aria-checked="false" tabindex="-1" class="btn sm borderless" data-tooltip="Tablet"><span class="visually-hidden">Tablet</span><svg class="icon" aria-hidden="true"><use href="#common-tablet"/></svg></button>
  <button type="button" role="radio" aria-checked="true" class="btn sm secondary ba bg-white" data-tooltip="Desktop"><span class="visually-hidden">Desktop</span><svg class="icon" aria-hidden="true"><use href="#common-monitor"/></svg></button>
</div>

Choice Pickers

A choice picker is a set of radiobuttons that look like buttons, e.g. for picking a time slot. Each option is a .btn.md (40px) or .btn.sm (32px) button with role="radio": the selected one is .primary, the others are .secondary. Put them in a wrapping row with .d-flex.flex-wrap.gap-8.

Use a choice picker when the options are short and people should see them all at once, e.g. in a card. For options in a form, use radiobuttons. To switch how content is displayed, use a segmented control.

Name the group with role="radiogroup" and aria-labelledby. Only the selected option is in the tab order (tabindex="-1" on the others; if nothing is selected yet, leave the first one without it). The script in the JS tab selects an option on click and moves the selection with the arrow keys.

Medium

Tour time

View codeHide code
<div>
  <p id="choice-time-label" class="mb-8">Tour time</p>
  <div class="d-flex flex-wrap gap-8" role="radiogroup" aria-labelledby="choice-time-label" data-choice-picker>
    <button type="button" role="radio" aria-checked="false" tabindex="-1" class="btn md secondary"><span>10–10:30 AM</span></button>
    <button type="button" role="radio" aria-checked="false" tabindex="-1" class="btn md secondary"><span>11–11:30 AM</span></button>
    <button type="button" role="radio" aria-checked="true" class="btn md primary"><span>2–2:30 PM</span></button>
    <button type="button" role="radio" aria-checked="false" tabindex="-1" class="btn md secondary"><span>3:30–4 PM</span></button>
  </div>
</div>

Small

Use .btn.sm (32px) where space is tight, e.g. in a narrow card or next to other small controls. Use the same size for all options in a group.

Tour time

View codeHide code
<div>
  <p id="choice-time-small-label" class="text-md mb-8">Tour time</p>
  <div class="d-flex flex-wrap gap-8" role="radiogroup" aria-labelledby="choice-time-small-label" data-choice-picker>
    <button type="button" role="radio" aria-checked="false" tabindex="-1" class="btn sm secondary"><span>10–10:30 AM</span></button>
    <button type="button" role="radio" aria-checked="false" tabindex="-1" class="btn sm secondary"><span>11–11:30 AM</span></button>
    <button type="button" role="radio" aria-checked="true" class="btn sm primary"><span>2–2:30 PM</span></button>
    <button type="button" role="radio" aria-checked="false" tabindex="-1" class="btn sm secondary"><span>3:30–4 PM</span></button>
  </div>
</div>

Toggles

View codeHide code
<div class="d-flex">
  <label class="toggle align-self-center mr-12">
    <input type="checkbox" name="toggle-name" id="toggle-id">
    <span class="toggle-btn"></span>
  </label>
  <label for="toggle-id">Toggle label</label>
</div>

Toggle with a Description

Put the label and the description in a column next to the toggle. Link the description to the input with aria-describedby, so screen readers read it after the label.

Use the underlined text style to display links.

View codeHide code
<div class="toggle-container d-flex align-items-center">
  <label class="toggle mr-12">
    <input type="checkbox" name="toggle-name" id="toggle-underline" aria-describedby="toggle-underline-help">
    <span class="toggle-btn"></span>
  </label>
  <div class="d-flex flex-column justify-content-center">
    <label for="toggle-underline">Underline links</label>
    <p class="text-md text-quiet text-wrap-all" id="toggle-underline-help">Use the underlined text style to display links.</p>
  </div>
</div>

Sliders

A slider is a range input with the slider attribute. It fills the track up to the current value. It comes in one size: a 4px track and a 16px knob.

The visible knob is smaller than the thumb you can grab: the touch target is 24×24px, which meets the WCAG 2.2 minimum target size.

Place it in a flex container and add .flex-grow: the slider has negative side margins so the knob lines up with the ends of the track, and it needs to grow into that space. Show the current value next to the label with an <output>. A short script sets the --value variable that fills the track.

The slider styles aren't in the Pathify stylesheet yet. Add the code from the CSS and JS tabs below to your page.
1.0x
1.0
View codeHide code
input[type="range"][slider] {
  --value: 0%; /* how much of the track is filled; set by the script below */
  --height: 20px;
  --track-height: 4px;
  --thumb-size: 24px; /* touch target */
  --knob-size: calc(var(--thumb-size) * 0.65); /* visible white knob */
  --overhang: calc((var(--thumb-size) - var(--knob-size)) / 2);
  width: 100%;
  height: var(--height);
  margin-left: calc(var(--overhang) * -1);
  margin-right: calc(var(--overhang) * -1);
  position: relative;
  appearance: none;
  outline: none;
  background: transparent;
}
/* Track (Chrome, Safari, Edge) */
input[type="range"][slider]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: var(--overhang);
  width: calc(100% - var(--overhang) * 2);
  height: var(--track-height);
  translate: 0 -50%;
  border-radius: 999rem;
  background: linear-gradient(90deg, var(--input-color) var(--value), var(--n2-transp) var(--value), var(--n2-transp) 100%);
}
input[type="range"][slider]::-webkit-slider-runnable-track {
  height: var(--track-height);
}
/* Track (Firefox) */
input[type="range"][slider]::-moz-range-track {
  height: var(--track-height);
  margin-left: var(--overhang);
  margin-right: var(--overhang);
  border-radius: 999rem;
  background: linear-gradient(90deg, var(--input-color) var(--value), var(--n2-transp) var(--value), var(--n2-transp) 100%);
}
/* Thumb: a large touch target that draws a smaller white knob with a shadow */
input[type="range"][slider]::-webkit-slider-thumb {
  position: relative;
  width: var(--thumb-size);
  height: var(--thumb-size);
  margin-top: calc((var(--track-height) / 2) + (var(--thumb-size) / 2) * -1);
  appearance: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 50%, white 0%, white 46%, rgba(0, 0, 0, 0.08) 49%, transparent 58%),
    radial-gradient(circle at 50% 58%, rgba(0, 0, 0, 0.17) 0%, transparent 59%);
}
input[type="range"][slider]::-moz-range-thumb {
  position: relative;
  left: calc(var(--thumb-size) / 4);
  width: var(--thumb-size);
  height: var(--thumb-size);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 50%, white 0%, white 46%, rgba(0, 0, 0, 0.08) 49%, transparent 58%),
    radial-gradient(circle at 50% 58%, rgba(0, 0, 0, 0.17) 0%, transparent 59%);
}
input[type="range"][slider]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px var(--focus-outline-color);
}
input[type="range"][slider]:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 2px var(--focus-outline-color);
}

Steppers

A stepper changes a number by one, e.g. the number of guests or tickets. It's a gray group (.bg-n1.rounded) of two borderless icon-only buttons with the value between them. It comes in two sizes: small uses .btn.xs buttons (28px) and 14px text (.text-md), medium uses .btn.md buttons (40px) and 16px text.

Show the value in an <output aria-live="polite"> so screen readers announce the change, and name the group with role="group" and aria-labelledby. Set the limits with data-min and data-max. Pressing and holding a button keeps changing the value: it starts repeating after half a second and speeds up after ten steps.

The value uses font-variant-numeric: tabular-nums;: all digits have the same width, so the stepper doesn't change width as the number changes. At a limit, the button gets .disabled and aria-disabled="true" instead of the disabled attribute, so it keeps keyboard focus (and its tooltip). Give the buttons “Decrease” and “Increase” tooltips (data-tooltip, see Tooltips).

Small

Tickets
1
View codeHide code
<div class="d-flex align-items-center gap-12">
  <span id="stepper-small-label" class="text-md">Tickets</span>
  <div class="d-inline-flex align-items-center bg-n1 rounded" role="group" aria-labelledby="stepper-small-label" data-stepper data-min="1" data-max="10">
    <button type="button" class="btn xs borderless disabled" aria-disabled="true" aria-label="Decrease" data-tooltip="Decrease"><svg class="icon" aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1z" fill-rule="evenodd"/></svg></button>
    <output class="px-8 text-md" style="font-variant-numeric: tabular-nums;" aria-live="polite">1</output>
    <button type="button" class="btn xs borderless" aria-disabled="false" aria-label="Increase" data-tooltip="Increase"><svg class="icon" aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M12 4a1 1 0 0 1 1 1v6h6a1 1 0 1 1 0 2h-6v6a1 1 0 1 1-2 0v-6H5a1 1 0 1 1 0-2h6V5a1 1 0 0 1 1-1z" fill-rule="evenodd"/></svg></button>
  </div>
</div>

Medium

Guests
2
View codeHide code
<div class="d-flex align-items-center gap-12">
  <span id="stepper-medium-label">Guests</span>
  <div class="d-inline-flex align-items-center bg-n1 rounded" role="group" aria-labelledby="stepper-medium-label" data-stepper data-min="1" data-max="8">
    <button type="button" class="btn md borderless" aria-disabled="false" aria-label="Decrease" data-tooltip="Decrease"><svg class="icon" aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1z" fill-rule="evenodd"/></svg></button>
    <output class="px-8" style="font-variant-numeric: tabular-nums;" aria-live="polite">2</output>
    <button type="button" class="btn md borderless" aria-disabled="false" aria-label="Increase" data-tooltip="Increase"><svg class="icon" aria-hidden="true" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M12 4a1 1 0 0 1 1 1v6h6a1 1 0 1 1 0 2h-6v6a1 1 0 1 1-2 0v-6H5a1 1 0 1 1 0-2h6V5a1 1 0 0 1 1-1z" fill-rule="evenodd"/></svg></button>
  </div>
</div>

File Upload

A file upload is a drop zone (.dropzone-button) that opens the file picker on click and accepts files dragged onto it. Its text goes in .text-1 and .text-2. The stylesheet handles the states: a blue border and text on hover and while files are dragged over it (add .dragover in your script), a focus ring, and a faded look when it's disabled.

Keep the real <input type="file"> hidden and open it from the drop zone. Name the whole control with role="group" and aria-labelledby, and link the size limit to the drop zone with aria-describedby.

Each file shows up as a chip above the drop zone (the space below the chips is a margin on each chip, so an empty list adds none): a loader while it uploads, then a page icon. Long names are cut at 150px and shown in full in the title. The button on the chip cancels the upload or removes the file; give it a hidden label with the file name and a “Cancel” or “Remove” tooltip (data-tooltip, see Tooltips). The script switches the tooltip when the upload finishes.

Default

Pick or drop files to try it. The script in the JS tab adds the chips; replace its fakeUpload with your own upload request.

Attachments

View codeHide code
<div role="group" aria-labelledby="upload-files-label" data-file-upload>
  <p id="upload-files-label" class="form-label required mb-4">Attachments</p>
  <input type="file" id="upload-files-input" class="hidden" multiple tabindex="-1">
  <ul class="d-flex flex-wrap gap-x-8 list-unstyled" data-file-list>
  </ul>
  <button type="button" class="dropzone-button" aria-describedby="upload-files-help">
    <svg class="icon size-32" aria-hidden="true"><use href="#common-upload"/></svg>
    <span class="text-1">Drag and drop files here or click to browse</span>
    <span class="text-2" id="upload-files-help">Max file size: 200 MB</span>
  </button>
  <template>
    <li class="d-flex align-items-center pa-8 mb-8 ba rounded bg-white">
      <span class="d-flex align-items-center justify-content-center size-24 mr-8"><span class="loader d-flex" role="status" aria-label="Uploading" data-uploading><svg class="size-20" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><g><animateTransform attributeName="transform" type="rotate" values="0 33 33;270 33 33" begin="0s" dur="1.4s" fill="freeze" repeatCount="indefinite"/><circle fill="none" stroke-width="11%" stroke-linecap="round" cx="33" cy="33" r="30" stroke-dasharray="187" stroke-dashoffset="610"><animateTransform attributeName="transform" type="rotate" values="0 33 33;135 33 33;450 33 33" begin="0s" dur="1.4s" fill="freeze" repeatCount="indefinite"/><animate attributeName="stroke-dashoffset" values="187;46.75;187" begin="0s" dur="1.4s" fill="freeze" repeatCount="indefinite"/></circle></g></svg></span><span class="d-flex hidden" data-uploaded><svg class="icon size-24 color-brand" aria-hidden="true"><use href="#common-page"/></svg></span></span>
      <span class="text-md text-truncate mr-4" style="max-width: 150px;" data-file-name></span>
      <button type="button" class="btn sm borderless" data-tooltip="Cancel"><span class="visually-hidden"></span><svg class="icon" aria-hidden="true"><use href="#internal-close"/></svg></button>
    </li>
  </template>
</div>

With Files

The first file is still uploading; the others are uploaded.

Attachments

  • Photo 1.jpg
  • File 2.pdf
  • Archived folder with a really long name.zip
View codeHide code
<div role="group" aria-labelledby="upload-progress-label" data-file-upload>
  <p id="upload-progress-label" class="form-label required mb-4">Attachments</p>
  <input type="file" id="upload-progress-input" class="hidden" multiple tabindex="-1">
  <ul class="d-flex flex-wrap gap-x-8 list-unstyled" data-file-list>
    <li class="d-flex align-items-center pa-8 mb-8 ba rounded bg-white">
      <span class="d-flex align-items-center justify-content-center size-24 mr-8"><span class="loader d-flex" role="status" aria-label="Uploading"><svg class="size-20" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><g><animateTransform attributeName="transform" type="rotate" values="0 33 33;270 33 33" begin="0s" dur="1.4s" fill="freeze" repeatCount="indefinite"/><circle fill="none" stroke-width="11%" stroke-linecap="round" cx="33" cy="33" r="30" stroke-dasharray="187" stroke-dashoffset="610"><animateTransform attributeName="transform" type="rotate" values="0 33 33;135 33 33;450 33 33" begin="0s" dur="1.4s" fill="freeze" repeatCount="indefinite"/><animate attributeName="stroke-dashoffset" values="187;46.75;187" begin="0s" dur="1.4s" fill="freeze" repeatCount="indefinite"/></circle></g></svg></span></span>
      <span class="text-md text-truncate mr-4" style="max-width: 150px;" title="Photo 1.jpg">Photo 1.jpg</span>
      <button type="button" class="btn sm borderless" data-tooltip="Cancel"><span class="visually-hidden">Cancel upload of Photo 1.jpg</span><svg class="icon" aria-hidden="true"><use href="#internal-close"/></svg></button>
    </li>
    <li class="d-flex align-items-center pa-8 mb-8 ba rounded bg-white">
      <span class="d-flex align-items-center justify-content-center size-24 mr-8"><svg class="icon size-24 color-brand" aria-hidden="true"><use href="#common-page"/></svg></span>
      <span class="text-md text-truncate mr-4" style="max-width: 150px;" title="File 2.pdf">File 2.pdf</span>
      <button type="button" class="btn sm borderless" data-tooltip="Remove"><span class="visually-hidden">Remove File 2.pdf</span><svg class="icon" aria-hidden="true"><use href="#internal-close"/></svg></button>
    </li>
    <li class="d-flex align-items-center pa-8 mb-8 ba rounded bg-white">
      <span class="d-flex align-items-center justify-content-center size-24 mr-8"><svg class="icon size-24 color-brand" aria-hidden="true"><use href="#common-page"/></svg></span>
      <span class="text-md text-truncate mr-4" style="max-width: 150px;" title="Archived folder with a really long name.zip">Archived folder with a really long name.zip</span>
      <button type="button" class="btn sm borderless" data-tooltip="Remove"><span class="visually-hidden">Remove Archived folder with a really long name.zip</span><svg class="icon" aria-hidden="true"><use href="#internal-close"/></svg></button>
    </li>
  </ul>
  <button type="button" class="dropzone-button" aria-describedby="upload-progress-help">
    <svg class="icon size-32" aria-hidden="true"><use href="#common-upload"/></svg>
    <span class="text-1">Drag and drop files here or click to browse</span>
    <span class="text-2" id="upload-progress-help">Max file size: 200 MB</span>
  </button>
  <template>
    <li class="d-flex align-items-center pa-8 mb-8 ba rounded bg-white">
      <span class="d-flex align-items-center justify-content-center size-24 mr-8"><span class="loader d-flex" role="status" aria-label="Uploading" data-uploading><svg class="size-20" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><g><animateTransform attributeName="transform" type="rotate" values="0 33 33;270 33 33" begin="0s" dur="1.4s" fill="freeze" repeatCount="indefinite"/><circle fill="none" stroke-width="11%" stroke-linecap="round" cx="33" cy="33" r="30" stroke-dasharray="187" stroke-dashoffset="610"><animateTransform attributeName="transform" type="rotate" values="0 33 33;135 33 33;450 33 33" begin="0s" dur="1.4s" fill="freeze" repeatCount="indefinite"/><animate attributeName="stroke-dashoffset" values="187;46.75;187" begin="0s" dur="1.4s" fill="freeze" repeatCount="indefinite"/></circle></g></svg></span><span class="d-flex hidden" data-uploaded><svg class="icon size-24 color-brand" aria-hidden="true"><use href="#common-page"/></svg></span></span>
      <span class="text-md text-truncate mr-4" style="max-width: 150px;" data-file-name></span>
      <button type="button" class="btn sm borderless" data-tooltip="Cancel"><span class="visually-hidden"></span><svg class="icon" aria-hidden="true"><use href="#internal-close"/></svg></button>
    </li>
  </template>
</div>

Disabled

After the form is submitted, disable the drop zone and remove the buttons from the chips.

Attachments

  • Photo 1.jpg
  • File 2.pdf
  • Archived folder with a really long name.zip
View codeHide code
<div role="group" aria-labelledby="upload-disabled-label">
  <p id="upload-disabled-label" class="form-label required mb-4">Attachments</p>
  <ul class="d-flex flex-wrap gap-x-8 list-unstyled">
    <li class="d-flex align-items-center pa-8 mb-8 ba rounded bg-white">
      <span class="d-flex align-items-center justify-content-center size-24 mr-8"><svg class="icon size-24 color-brand" aria-hidden="true"><use href="#common-page"/></svg></span>
      <span class="text-md text-truncate pr-4" style="max-width: 150px;" title="Photo 1.jpg">Photo 1.jpg</span>
    </li>
    <li class="d-flex align-items-center pa-8 mb-8 ba rounded bg-white">
      <span class="d-flex align-items-center justify-content-center size-24 mr-8"><svg class="icon size-24 color-brand" aria-hidden="true"><use href="#common-page"/></svg></span>
      <span class="text-md text-truncate pr-4" style="max-width: 150px;" title="File 2.pdf">File 2.pdf</span>
    </li>
    <li class="d-flex align-items-center pa-8 mb-8 ba rounded bg-white">
      <span class="d-flex align-items-center justify-content-center size-24 mr-8"><svg class="icon size-24 color-brand" aria-hidden="true"><use href="#common-page"/></svg></span>
      <span class="text-md text-truncate pr-4" style="max-width: 150px;" title="Archived folder with a really long name.zip">Archived folder with a really long name.zip</span>
    </li>
  </ul>
  <button type="button" class="dropzone-button" aria-describedby="upload-disabled-help" disabled>
    <svg class="icon size-32" aria-hidden="true"><use href="#common-upload"/></svg>
    <span class="text-1">Drag and drop files here or click to browse</span>
    <span class="text-2" id="upload-disabled-help">Max file size: 200 MB</span>
  </button>
</div>