Menu

Upgrade to 1.8

Added in 1.8.0

Move a project from Tabler 1.7 to 1.8. Eight base colors and the success and warning colors are darker, and the color shades and link colors are CSS values that Sass color functions can't read. Dropzone.js, the IMask path of the input mask and one button variable are deprecated.

Tabler 1.8 adds a lot, and for most projects the upgrade is a version bump. Every class, data attribute and JavaScript export from 1.7 is still there, and a page that loads the compiled CSS and JS needs no change to its markup.

Two things can touch your code, and both are about colors. Eight base colors and the success and warning theme colors are darker, so light text is readable on them. The color shades, $blue-100 to $cyan-900, and a few variables such as $link-color are CSS values now, so Sass color functions such as color.adjust() can't read them. If you're happy with the new shades and your Sass never changes a Tabler shade or the link color, you can skip both.

Three things are deprecated and keep working until 2.0: Dropzone.js, the IMask path of the input mask, and the $btn-transition Sass variable. Then have a look at Visual changes.

If you're coming from 1.6 or older, do the 1.7 upgrade first.

Overview

If you… You need to…
Load the compiled CSS and JS, and write no CSS with --tblr-link-color-rgb Nothing
Use --tblr-link-color-rgb or --tblr-link-hover-color-rgb in your CSS Use color-mix(), see RGB custom properties of links
Call color.adjust(), darken() or another Sass color function on a shade such as $blue-100, or on $link-color Use the Tabler functions or color-mix(), see Color shades and link colors are not Sass colors
Use Dropzone.js from dist/libs/dropzone Nothing now; move to the Dropzone plugin before 2.0, see Dropzone.js is deprecated
Load IMask for data-mask fields Nothing now; drop IMask before 2.0, see Input mask without IMask
Need the 1.7 shade of green, orange or another color Set the color yourself, see Darker theme colors
Keep a size budget for JavaScript Check it, see Bundle size
Set $btn-transition in your Sass Nothing now; switch to the three new variables before 2.0, see Sass changes
Lint with @typescript-eslint/no-floating-promises Mark the calls you don't await with void, see Methods return a Promise
Use .link-underline*, .link-offset-*, .lh-base or .placeholder-glow Nothing, see New names for a few classes
Style text, inline code, checks or switches yourself Check them, see Visual changes

Update the package

Install the new version:

npm install --save @tabler/[email protected]

Or update the CDN links:

<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/css/tabler.min.css"
/>
<script src="https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/js/tabler.min.js"></script>

$link-color and $link-hover-color are CSS values in 1.8, so a link follows --tblr-primary when you change it at runtime. Sass can't turn such a value into an r, g, b triplet, so the two deprecated triplet properties of links are no longer emitted. Tabler itself doesn't read them.

No longer emitted Use instead
--tblr-link-color-rgb --tblr-link-color
--tblr-link-hover-color-rgb --tblr-link-hover-color

Every other -rgb property, such as --tblr-primary-rgb or --tblr-blue-rgb, is still there.

If your CSS builds a transparent color from one of the two triplets, use color-mix() on the color itself:

  .my-highlight {
-   background-color: rgba(var(--tblr-link-color-rgb), 0.5);
+   background-color: color-mix(in srgb, var(--tblr-link-color) 50%, transparent);
  }

This only matters if you compile the scss/ sources and run Sass color functions on these variables.

The -100 to -900 shades of the base colors, $blue-100 to $cyan-900, are color-mix() values, and the -500 shade is a var() reference to the color. $link-color, $link-color-dark, $link-hover-color, $link-hover-color-dark, $component-active-bg, $mark-bg and the form validation colors are built on var() references. To Sass all of these are strings, not colors, so a native Sass color function stops with an error:

Error: $color: color-mix(in oklab, #fff 80%, var(--blue)) is not a color.

That happens with color.adjust(), color.scale(), color.change(), color.channel(), darken() and lighten().

The base colors $blue to $cyan and the theme colors $primary, $success, $info, $warning and $danger are Sass colors, as in 1.7. Every Sass function works on them.

Tabler's own functions, tint-color(), shade-color(), shift-color() and mix-color(), accept the new values and write a CSS color-mix() for them. Use them, or write color-mix() yourself:

  @use '@tabler/core/scss/tabler' as tabler;

  .my-badge:hover {
-   background-color: color.adjust(tabler.$blue-100, $lightness: -5%);
+   background-color: tabler.shade-color(tabler.$blue-100, 10%);
  }

  .my-overlay {
-   background-color: color.change(tabler.$link-color, $alpha: 0.5);
+   background-color: color-mix(in srgb, var(--tblr-link-color) 50%, transparent);
  }

A value you configure yourself is a Sass color again, and every Sass function works on it:

@use '@tabler/core/scss/tabler' with (
  $link-color: #7c3aed
);

Dropzone.js is deprecated

tabler.js has its own Dropzone plugin now, started with data-bs-toggle="dropzone". The Dropzone.js library is deprecated. dist/libs/dropzone and its styles in tabler-vendors.css stay until 2.0, so existing pages keep working.

Both use the .dropzone class. The old styles apply only to a .dropzone without a .dropzone-area inside, so the two can live on the same page. Don't use both on the same element.

- <form class="dropzone" id="dropzone-default" action="/upload">
-   <div class="fallback">
-     <input name="file" type="file" />
-   </div>
- </form>
- <script src="/dist/libs/dropzone/dist/dropzone-min.js"></script>
- <script>
-   new Dropzone('#dropzone-default')
- </script>
+ <div class="dropzone" data-bs-toggle="dropzone" data-bs-url="/upload">
+   <label class="dropzone-area">
+     <input class="dropzone-input" type="file" name="file" multiple />
+     <span class="dropzone-title">Drop files here or click to upload</span>
+   </label>
+ </div>

The Migration from Dropzone.js table maps every option and event.

Input mask without IMask

The input mask formats data-mask patterns natively, with the same 0, a and * characters. Tabler doesn't need the IMask library any more.

If your page still loads IMask, a plain data-mask pattern goes to IMask as before, with every IMask option. This keeps existing code working. It's deprecated and goes away in 2.0. To move a page off IMask, remove the script:

- <script src="/dist/libs/imask/dist/imask.min.js"></script>
  <input type="text" class="form-control" data-mask="00/00/0000" />

To use the native mask on a page that has to keep loading IMask, add data-mask-type="pattern":

<input type="text" class="form-control" data-mask="00/00/0000" data-mask-type="pattern" />

The new date and number types, data-mask-ranges and tokens are always native.

The native mask takes a string or a function as mask. A mask that only IMask understands, such as a RegExp, Number, Date or an array of masks, still needs the library. Without IMask on the page such a field gets no mask, and the console shows a warning. Rewrite these masks before you remove the script. data-mask-type="number" and data-mask-type="date" replace Number and Date.

- new tabler.InputMask(element, { mask: Number, scale: 2, thousandsSeparator: ' ' })
+ new tabler.InputMask(element, { type: 'number', scale: 2, thousandsSeparator: ' ' })

The mask getter returns the IMask instance only when IMask handles the field. With the native mask it returns the component, which has the same value and unmaskedValue properties.

Methods return a Promise

show(), hide(), toggle() and close() return a Promise that resolves when the transition ends. In 1.7 they returned nothing. Code that ignores the return value works as before.

Projects that lint with @typescript-eslint/no-floating-promises get a new error on every call that isn't awaited. Mark those calls with void:

- modal.show()
+ void modal.show()

New names for a few classes

A few utilities got a second name, so they read better next to the new ones. The old names still work and do the same, so there's nothing to change.

Class in 1.7 New name in 1.8
.link-underline, .link-underline-{color} .underline, .underline-{color}
.link-underline-opacity-{value} .underline-{value}
.link-offset-{1-3} .underline-offset-{1-3}
.lh-base .lh-md
.placeholder-glow .placeholder-pulse

Darker theme colors

Eight base colors are darker in 1.8, so white text on them reaches a 3:1 contrast ratio. blue, indigo, purple and yellow keep their 1.7 value. A color is the same in light and dark mode, as before.

Color 1.7 1.8
azure #4299e1 #1877bd
pink #d6336c #d3306a
red, danger #d63939 #d33637
orange #f76707 #c14e00
lime #74b816 #4d7f00
green, success #2fb344 #008424
teal #0ca678 #00825d
cyan #17a2b8 #017d90
warning #f59f00, the same as yellow #a96100

warning is its own color now and carries light text. yellow is unchanged and keeps dark text.

If you need a 1.7 shade, set the color yourself:

:root {
  --tblr-green: #2fb344;
  --tblr-success: #2fb344;
}

Or in Sass:

@use '@tabler/core/scss/tabler' with (
  $green: #2fb344
);

If you already set a color, for example --tblr-primary or $primary, nothing changes for it.

Three more things follow the color at runtime now:

  • The text color on a colored background, --tblr-{color}-fg, is worked out in the browser from the color itself. In 1.7 it was fixed when the CSS was compiled, so a light --tblr-primary set in CSS kept its white text.
  • Every base and theme color has a --tblr-{color}-text shade for text, darker than the color in light mode and lighter in dark mode. See Text colors.
  • The valid and invalid colors of form fields follow --tblr-success and --tblr-danger.

If you set a -fg property yourself, your value still wins. When you change a color on an element other than the root, set its -fg and -text properties there as well.

Bundle size

Combobox, Dropzone, Phone input and the native input mask are part of tabler.js, so the file is bigger. In return a page no longer has to load Dropzone.js, IMask or Tom Select for these fields.

File 1.7.5 1.8.0
tabler.min.js, gzipped 43.7 kB 60.8 kB
tabler.min.css, gzipped 86.1 kB 94.3 kB

Visual changes

Nothing in this section needs a change to your markup. A few things are drawn a little differently in 1.8. If you have a custom style that sits next to one of them, have a quick look.

  • Darker text. $dark and $body-color are $gray-900 instead of $gray-800, and the light mode --tblr-body-color is gray-800 instead of gray-700.
  • Darker colors. azure, pink, red, orange, lime, green, teal, cyan, success and warning are darker, and every color except yellow carries light text. See Darker theme colors for the values and how to keep a 1.7 shade.
  • Colored text. The text-* and link-* utilities, the text in a bg-*-lt element, outline and ghost buttons, alerts and statuses use the --tblr-{color}-text shade instead of the color itself, so the text is darker in light mode and lighter in dark mode.
  • Code blocks. A pre has a light surface and dark text in light mode. In 1.7 it was dark in both modes. It's still dark in dark mode.
  • Inline code. It takes the color of the text around it, with a light tint of that color as its background. In 1.7 it was gray text on --tblr-fill-tertiary, which was hard to read on a button or another colored surface.
  • Neutral backgrounds. Card headers and footers, table headers, striped rows, the modal footer and input group add-ons use the --tblr-fill-* tokens instead of --tblr-bg-surface-tertiary.
  • Checks, radios and switches. Their marks animate when the state changes. --tblr-control-transition-duration sets the speed.
  • Tooltips and popovers. A tooltip or a hover popover stays open while the pointer is over the tip, and every tooltip and popover closes on Escape, also a popover with the click or manual trigger.
  • Reduced motion. Transitions and animations are written inside prefers-reduced-motion: no-preference. For a user who asked for reduced motion they don't run at all.
  • Native controls. The root element sets accent-color to the primary color, so a checkbox, radio, range input or <progress> without Tabler classes uses the theme color.
  • Focus ring on wrappers. .form-control shows the focus ring on :focus-within, so a .form-control wrapper with an input inside gets it too.
  • Native <dialog>. It opens and closes with a short animation, and so does its backdrop.
  • Toggle buttons. A [data-bs-toggle="button"] button gets aria-pressed on load, true when it has .active.

Sass changes

This only matters if you compile the scss/ sources yourself. No variable, mixin or function was removed, so @use … with (…) keeps compiling.

Deprecated variables

Variable Use instead
$btn-transition $btn-transition-property, $btn-transition-duration, $btn-transition-timing

A value you set for $btn-transition still replaces the three new ones. It goes away in 2.0.

  @use '@tabler/core/scss/tabler' with (
-   $btn-transition: color 0.2s ease-out, background-color 0.2s ease-out
+   $btn-transition-property: (color, background-color),
+   $btn-transition-duration: 0.2s,
+   $btn-transition-timing: ease-out
  );

Changed defaults

Variable 1.7 1.8
$azure, $pink, $red, $orange, $lime, $green, $teal, $cyan See Darker theme colors A darker oklch() color
$warning $yellow oklch(56% 0.15 71.02deg)
$blue-100 to $cyan-900 tint-color() or shade-color() result color-mix() value
$dark, $body-color $gray-800 $gray-900
$link-color, $component-active-bg $primary var(--primary)
$form-feedback-valid-color, $form-feedback-invalid-color $success, $danger var(--success), var(--danger)
$mark-bg $yellow-100 A color-mix() of var(--yellow) and white
$card-cap-bg, $card-header-tabs-bg, $modal-footer-bg, $table-th-bg, $table-striped-bg, $input-group-addon-bg var(--bg-surface-tertiary) var(--fill-quaternary)
$pagination-focus-bg var(--secondary-bg) var(--fill-tertiary)
$mockup-browser-toolbar-bg var(--bg-surface-secondary) var(--fill-tertiary)
$pre-bg var(--bg-surface-dark) var(--bg-surface-secondary)
$pre-color var(--light) The body color in light mode, var(--light) in dark mode
$code-color --gray-600 in light mode, --gray-400 in dark mode currentColor
$code-bg var(--fill-tertiary) A tint of currentColor
$active-color var(--primary) var(--primary-text)
$avatar-bg var(--fill-tertiary) A tint of the body color on var(--bg-surface)

The validation icons in $form-feedback-icon-valid and $form-feedback-icon-invalid use fixed hex colors, because a var() reference doesn't work inside an SVG data URI. If you change $green or $red, set the two icons as well.

What is new in 1.8

Besides the changes above, 1.8 adds:

  • Combobox, a select with options written as HTML, search, tags and full keyboard control, from a <select> with data-bs-toggle="combobox".
  • Phone input, a type="tel" field with a country picker, flags and dial codes.
  • Dropzone, a file field with a drop area, a file list and optional upload.
  • Input mask with native patterns and the number and date types.
  • Code block, a pre with a header, a copy button, line numbers and highlighted lines.
  • Select all, a plugin that checks every row of a selectable table or list, with .selection-toolbar for bulk actions.
  • Banner, a strip above the navbar that stays closed with data-bs-banner-id.
  • File icon, a sheet with the file format on a colored label.
  • Bento grid, with .grid-bento and the .g-row-* classes.
  • Toggler, a plugin that toggles a class or an attribute on click.
  • Stacked modals with data-bs-stacked="true".
  • Offcanvas with swipe to dismiss, .offcanvas-inset and --tblr-offcanvas-backdrop-blur.
  • tabler.init(root) and tabler.dispose(root) for markup added after page load.
  • Form validation with form[data-bs-validate], which styles a field with :user-invalid after the user has left it.
  • Utilities for CSS grid: .grid-cols-*, .grid-auto-flow-*, and .justify-items-*, .place-items-* and the responsive .justify-self-*.
  • Utilities for sizes: .min-w-0, .min-h-0, .w-fit-content and the dynamic viewport units, such as .dvh-100.
  • Utilities for text: .text-truncate-2 to .text-truncate-5, .text-balance, .text-pretty and .underline-thickness-*.
  • .d-flow-root and .d-contents in the display utilities, .contains-inline and .contains-size for container queries, .shadow-xs and .shadow-xl in shadows, .border-keyline and .hover-lift.
  • Text colors: a --tblr-{color}-text shade for every base and theme color, and -fg colors that the browser works out from the color.
  • A Color contrast page in the demo, with the WCAG contrast ratio of every color pairing in light and dark mode.
  • CSS variables for cards, tables, modals, dropdowns, list groups, navs, the carousel, the offcanvas, loaders, the timeline, stars, placeholders, button groups, pricing, social icons, flags, payments and nav overflow.
  • A Tabler Flags section in the docs.

See the changelog for the full list.