0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Sets the base text direction (ltr, rtl or auto). Needed for Arabic, Hebrew, Persian and Urdu; VB mirrors direction-specific UI through :dir(rtl).
Overview
The dirattribute sets the base direction of an element's text: left to right, right to left, or worked out from the content. Right-to-left languages such as Arabic, Hebrew, Persian and Urdu need it; without it punctuation lands at the wrong end and mixed text reorders. Direction is inherited, so set it on <html> for the page and on any element whose direction differs.
Applies to: every element (it is a global attribute). <bdi> defaults to auto, and <bdo> requires ltr or rtl.
Isolated names, auto direction, and an RTL section
123456789101112131415161718192021222324
<p>User <bdi>إيمان</bdi> left 3 comments.</p><form-field><labelfor="dir-message">Message</label><inputtype="text"id="dir-message"name="message"dir="auto"></form-field><sectionlang="ar"dir="rtl"aria-labelledby="rtl-heading"><h2id="rtl-heading">واجهة من اليمين إلى اليسار</h2><navclass="breadcrumb"data-separator="chevron"aria-label="مسار التنقل"><ol><li><ahref="/">الرئيسية</a></li><li><ahref="/docs/">المستندات</a></li><li><spanaria-current="page">السمات</span></li></ol></nav><details><summary>تفاصيل الطلب</summary><p>تم شحن الطلب رقم <bdi>1042</bdi> يوم الثلاثاء.</p></details><label><inputtype="checkbox"data-switchchecked> الإشعارات</label><buttontype="button">التالي <icon-wcname="arrow-right"data-flip-rtl></icon-wc></button><pre><code>npm install vanilla-breeze</code></pre></section>
Values
Value
Meaning
ltr
Left to right.
rtl
Right to left.
auto
The browser picks the direction from the first strong directional character in the content. For text inputs and textareas it looks at the value.
Absent, "" or an unknown value
Inherited from the parent. On <html> with no value, ltr.
Wrap user-supplied names, labels and numbers in <bdi>. Without isolation, an Arabic or Hebrew name in an English sentence can pull the following words and numbers into its direction: "User إيمان left 3 comments" can display with the "3" in the wrong place.
bdi for user content
12
<p>User <bdi>إيمان</bdi> left 3 comments.</p><p>User <bdi>Alice</bdi> left 3 comments.</p>
For a whole block of user content, use dir="auto" on its container:
dir=auto on a comment
123
<articledir="auto"><p>شكراً على المساعدة!</p></article>
Overriding the algorithm
<bdo> forces characters into one order regardless of their own direction. It is rarely needed; use it to show text exactly as stored, such as a part number.
The :dir(rtl) pseudo-class matches every element whose resolved direction is right to left, including elements that inherit it and dir="auto" elements that resolve to RTL. The attribute selector [dir="rtl"] only matches the element that carries the attribute.
:dir() follows inheritance
123456789
/* Matches the element and everything inside it that is RTL */.step-arrow:dir(rtl) {transform: scaleX(-1);}/* Only matches elements with the attribute itself: avoid */[dir="rtl"].step-arrow {transform: scaleX(-1);}
Better still, write direction-neutral CSS with logical properties (margin-inline-start, padding-inline-end, inset-inline-start, text-align: start, float: inline-end) so nothing needs flipping.
In Vanilla Breeze
Logical properties throughout. Spacing, borders, alignment and positioning follow the inline direction, so layouts mirror with no extra CSS.
Mirroring with :dir(rtl). Where a logical property is not enough, VB flips direction-specific details with :dir(rtl) rules, for example:
breadcrumb separators, nav.breadcrumb and <bread-crumb> (src/native-elements/nav/styles.css, src/web-components/bread-crumb/styles.css)
the <summary> disclosure marker (src/native-elements/details/styles.css)
side sheets, dialog[data-position="start|end"] (src/native-elements/dialog/styles.css)
the range fill and the switch knob (src/native-elements/input/range.css, input/switch.css)
table edge and row-highlight bars, drawn with physical box-shadows (src/native-elements/table/styles.css), shapes, callouts and speech bubbles (src/shapes/), data-float (src/utils/float.css)
slide view transitions: data-vt-class="slide-forward" moves content toward the start of the line, which is the left in LTR and the right in RTL (src/utils/view-transitions.css)
Icons opt in. Icons are not mirrored automatically, because checkmarks, clocks and logos must not flip. Add data-flip-rtl to directional glyphs: <icon-wc name="arrow-right" data-flip-rtl> (src/web-components/icon-wc/styles.js). See icons.
Code stays left to right.pre blocks that contain code or samp are forced to direction: ltr inside RTL pages, unless the pre has its own dir (src/native-elements/code/styles.css).
Keyboard arrows follow direction. Components with arrow-key navigation, such as <tab-set>, splitters and carousels, swap Left and Right in RTL.
No [dir] rules on purpose. The browser already gives [dir] elements bidi isolation, and <bdi> / <bdo> their behaviour. Re-declaring them weakened isolation, so VB leaves them alone (src/native-elements/i18n/styles.css, section 5).
Script helpers.isRTL(locale) in src/lib/i18n.js reports whether a language is written right to left.
Accessibility
Pair dir with lang.dir sets the layout direction; lang tells screen readers which voice and pronunciation to use.
Use the attribute, not CSS direction. The CSS specification asks authors not to set direction for document text. The attribute is part of the content: it drives :dir(), bidi isolation and form submission through dirname, and it survives without CSS.
Mirror meaning, not everything. Arrows that mean "next" flip; media controls, clocks and numbers do not.
Browser support
The dirattribute is supported everywhere. The :dir() pseudo-class is Baseline widely available since 2026 (Chrome 120, Firefox 49, Safari 16.4).
Gotchas
dir="auto" looks only at the first strong character. A message that starts with an English brand name and continues in Arabic resolves to LTR.
Physical CSS does not mirror.margin-left, left: 0 and text-align: left stay on the left in RTL. Use the logical forms.
Background gradients and transforms are physical.linear-gradient(to right, …) and translateX() need a :dir(rtl) override, as VB does for the range fill and side sheets.
Submitting direction. The text direction of a field is not sent with the form unless you add dirname.