Forms✨ Premium

Select Animated

A real native dropdown restyled in CSS: indigo border and a drawn chevron that turns upward while the field has focus, with the system list kept.

CSSTransformSelect

Updated

This effect is part of Effect.Labs — 840 vanilla effects, some free, some premium. Forms has 20 effects, including 2 free. Explore the category →

3 usage examples

Time zone of a meeting invitation between two offices — Select Animated example 1

① Time zone of a meeting invitation between two offices

WhenWhile setting up the quarterly review with the Montréal office, the organiser opens "Time zone": the border darkens, the chevron turns up, she picks Montréal and the line below instantly converts the time for the Paris colleagues.
WhyThe time zone is a small setting that rarely changes but must not be missed: a real select keeps the system list, with its first-letter search, and the turning chevron shows the field is active.
Settings--slx-w: 196px inside a form row, colours switched to blue #4b6cb7 (border and chevron), options on a white background. The conversion under the field is shown by the scene on the change event; in the capture, the scene picks Montréal on first focus (the native list is not captured) then leaves the field.
Sorting listings in a property search — Select Animated example 2

② Sorting listings in a property search

WhenAbove the list, the buyer switches the sort from "Relevance" to "Price, low to high", by keyboard (Tab then down arrow) or mouse: the listings reorder at once.
WhyA sort is a single choice among few options that must stay compact in a bar; the native select lets keyboard and mobile work with no code.
Settings--slx-w: 190px, compact select (13 px, 8 px chevron), teal #0f766e. The reordering is done by the scene on the change event.
Date, time and guests in a restaurant booking widget — Select Animated example 3

③ Date, time and guests in a restaurant booking widget

WhenIn the booking card, three menus side by side; the customer taps "Guests", switches to 4 people and the button becomes "Book for 4".
WhyThree identical selects make a short, even form; on a phone, each opens the native picker, far easier with a thumb than a custom list.
SettingsThree .slx-field in a grid, --slx-w: 100%, orange #f2a46a on a brown background, options on a dark background. Each select is named by its visible <label>.

How it works

The effect keeps a native <select>: only its look changes. appearance: none removes the system arrow, a 2 px rgba(99,102,241,.3) border and 10 px corners dress it, and the text takes its parent's colour (color: inherit). The list that opens is still the browser's, and on mobile the phone's native picker (wheel on iPhone, full-screen list on Android).

The chevron is the ::after pseudo-element of the .slx-field container: a 10 px square with only its right and bottom borders drawn, rotated 45°. When the select has focus, .slx-field:focus-within::after turns it to −135° (pointing up) in 0.3 s and the border becomes solid #6366f1; keyboard focus adds a light halo. So it turns on focus, not when the list opens: after a mouse choice, it stays up while the field keeps focus, and comes back down when you move on.

No JavaScript. The width is --slx-w (280 px by default, 100% to fill a column); classes are prefixed slx-.

Accessibility

  • Accessible name: the select carries aria-label="Your choice"; in a form, prefer a visible label by wrapping it all in a <label> ("Time zone"), which names the field with no id.
  • Native keyboard: Tab, arrows, an option's first letter, Alt + down arrow to open: it all works since it is the browser's control.
  • Visible focus: solid indigo border on focus, plus an rgba(165,180,252,.45) halo on keyboard focus (:focus-visible).
  • Mobile: the list is the system's, with its text size and accessibility settings.
  • Reduced motion: under prefers-reduced-motion: reduce, the chevron and border change without transition.

Browser compatibility

CSS only: unprefixed appearance: none (Chrome 84, Firefox 80, Safari 15.4), :focus-within, ::after. Measured in Chromium 151, Firefox 153 and WebKit 26.5 (Playwright): mouse choice, Tab then arrow, two independent copies, 390 px, reduced motion. <option> styling (#1a1a2e background) is only applied by Chrome, Edge and Firefox on Windows and Linux; macOS and iOS show their system list.

Chrome 86+✓ Full (measured)
Firefox 85+✓ Full (measured)
Safari 15.4+✓ Full (measured in WebKit), system list
Edge 86+✓ Full (Chromium engine)
Mobile iOS 15.4+✓ Native picker, not checked on a device
Android Chrome 86+✓ Full, native picker

Without appearance: none, the system arrow shows next to the drawn chevron; the menu stays fully usable.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0298-root">
  <div class="slx-field">
    <select name="choice" aria-label="Your choice">
      <option value="">Choose an option...</option>
      <option value="1">Option 1</option>
      <option value="2">Option 2</option>
      <option value="3">Option 3</option>
    </select>
  </div>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
Width (CSS — --slx-w) 280px 100% to fill a form column; the field never overflows its container (max-width: 100%).
Colour (CSS — border-color on focus and the borders of .slx-field::after) #6366f1, resting border at 30% Change all three together for a field consistent at rest and on focus.
Chevron rotation (CSS — .slx-field:focus-within::after) rotate(-135deg) in .3s Remove the rule for a fixed chevron, or lengthen the transition.
Open list (CSS — select option) #1a1a2e background, white text On a light background, switch to white background and dark text; ignored by Safari and iOS.
Name and label (HTML — name, aria-label or <label>) choice · "Your choice" Use the field's real name; a visible label beats an aria-label.
Demo frame (CSS — .fx-0298-root) min-height 300px, #0a0a0f background, white text Remove it in a real page; the select's text then follows the page's colour.

FAQ

It follows focus, not the list opening: after a mouse choice, the field keeps focus. It comes down as soon as you click elsewhere or move to the next field. Browsers do not offer a reliable "list open" state everywhere.
Very little: the list belongs to the system. Background and text colour work on Windows and Linux, not on macOS or iOS. For a fully drawn list you need a JavaScript component with role="listbox", at the cost of the native picker on mobile.
Put value="" on the first option (already the case) and required on the select: the form refuses to send until a real option is picked.