How to Build an OTP Input: One Real Input or One per Digit

A six-slot verification code field on a purple gradient, with three digits filled and the fourth slot ringed as the active one

A verification code field usually looks like a row of boxes, one per character. There are two ways to build it. You can render one <input> per box and move the focus from box to box, or you can render one real <input> and draw the boxes underneath it from its value and its selection.

The two look the same, but they are not the same amount of work. A field per digit splits one value over six editors, so it has to rebuild, box by box, how text is replaced, composed, undone and autofilled, and a screen reader meets six fields instead of one. A single input keeps the browser’s editing model, the undo history of the edits that go through it, and one name for the whole code; the script still handles the slot selection, IME composition and text inserted several characters at once. This guide compares the two models, then builds the single input with that short list.

Read More…

CoreUI for React v5.14.0 - XXL Modal Size and Carousel Swipe Fix

CoreUI for React v5.14.0 - XXL Modal Size and Carousel Swipe Fix

We are pleased to announce the release of CoreUI for React v5.14.0. This release adds an extra extra large xxl size to CModal, fixes how CCarousel reads touch swipes in browsers without Pointer Events, and moves to the @coreui/coreui v5.10.0 stylesheet.

Read More…

CoreUI PRO for React v5.30.0 - XXL Modal Size and Carousel Swipe Fix

CoreUI PRO for React v5.30.0 - XXL Modal Size and Carousel Swipe Fix

We are pleased to announce the release of CoreUI PRO for React v5.30.0. This release adds an extra extra large xxl size to CModal, fixes how CCarousel reads touch swipes in browsers without Pointer Events, and moves to the @coreui/coreui-pro v5.30.0 stylesheet.

Read More…

How to Build a Controlled Accordion on the Details Element

A CoreUI accordion with Shipping, Returns and Payment items on a purple gradient, the Returns item halfway open under the mouse pointer

The <details> element is a good base for an accordion. The browser gives it keyboard support, exposes its expanded state to assistive technology, closes the other open item of a group that shares a name, and, in browsers that search closed disclosures, opens an item when a find-in-page match is inside it. None of that needs JavaScript, and if nothing in your page has to approve or follow which items are open, a plain <details name> group is all you need.

The trouble starts when the open items belong to your state: a form wizard that refuses to open step two before step one is valid, a route that decides which section is open, a React or Vue component with a value and an onChange. A <details> element toggles itself, and it does not wait for your permission. This guide shows how to build an accordion on top of it that does what the state says, and only that.

Read More…

CoreUI v6 Alpha: What Changes and Why

CoreUI v6 Alpha: What Changes and Why

The first alpha of CoreUI v6 is on npm. It covers three packages: CoreUI PRO for Bootstrap (@coreui/coreui-pro), for React (@coreui/react-pro) and for Vue (@coreui/vue-pro), each published as 6.0.0-alpha.0 under the next tag. The free editions and Angular follow in later alphas.

Two weeks earlier the Bootstrap team published the first Bootstrap 6 alpha. CoreUI has always been built on Bootstrap, and v6 follows the same architecture: cascade layers, a token map per component, theme classes and colours computed in the browser. Where a class, token, option or event exists in both libraries, it almost always has the same name. What we took from Bootstrap 6, what we did not take and why is the subject of a separate post. This one is about what v6 gives you.

It is an alpha. The API can still change before the release candidate, so pin the exact version and keep it out of production for now.

Read More…

CoreUI PRO for React v6.0.0-alpha.0 - First v6 Alpha

CoreUI PRO for React v6.0.0-alpha.0 - First v6 Alpha

We are pleased to announce CoreUI PRO for React v6.0.0-alpha.0, the first alpha of v6. It is built on CoreUI PRO v6.0.0-alpha.0, and each component now imports the stylesheet it renders into, so an app ships only the CSS it uses. The API can still change before the release candidate, so pin the exact version and do not use it in production yet. The v6 documentation is published next to the v5 docs.

Read More…

CoreUI PRO for React v5.29.2 - Search Button Key Event Fix

CoreUI PRO for React v5.29.2 - Search Button Key Event Fix

We are pleased to announce the release of CoreUI PRO for React v5.29.2. This patch release makes CSearchButton ignore key events that carry no key, instead of throwing an error on any page that renders it.

Read More…

CoreUI PRO for React v5.29.1 - Time Picker, Calendar and Date Picker Fixes

CoreUI PRO for React v5.29.1 - Time Picker, Calendar and Date Picker Fixes

We are pleased to announce the release of CoreUI PRO for React v5.29.1. This patch release fixes how CTimePicker handles an empty value, makes CCalendar open on a month with days to pick when minDate or maxDate exclude today, and makes CDatePicker and CDateRangePicker pass the formatted date their callbacks declare.

Read More…

CoreUI for React v5.13.1 - Offcanvas and Chip Input Fixes

CoreUI for React v5.13.1 - Offcanvas and Chip Input Fixes

We are pleased to announce the release of CoreUI for React v5.13.1. This maintenance release gives the page its scrolling back when a visible COffcanvas unmounts, fixes the disabled and readonly states of CChipInput, and moves to the @coreui/coreui v5.9.1 stylesheet.

Read More…

CoreUI PRO for React v5.29.0 - Time Granularity in the Date Pickers

CoreUI PRO for React v5.29.0 - Time Granularity in the Date Pickers

We are pleased to announce the release of CoreUI PRO for React v5.29.0. CDatePicker and CDateRangePicker can now drop minutes and seconds from their time selection. The release also keeps internal fields out of submitted form data and fixes CCalendar, CMultiSelect, CAutocomplete and COneTimePassword.

Read More…
Subscribe to our newsletter
Get early information about new products, product updates and blog posts.