Install
Install component from your command line.Getting started
This component uses Tailwind CSS 4, which comes with
@vuemaildev/vuemail.Props
object
Customize the default theme for your project with the available properties in
Tailwind docs, as a JavaScript configuration
object.
string
CSS with a Tailwind
@theme block, the same you would write in your stylesheet with
Tailwind CSS 4, like @theme { --color-brand: #42b883; }.string
CSS for utility classes of your own, like
.custom-shadow { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); },
which get inlined like any other utility.Most email clients are style-limited and some styles may not work.One example of this is how Tailwind uses
rem as its main unit for better accessibility. This
is not supported by some email clients, and
the pixelBasedPreset changes it so that the styles are based on 16px instead.Configuring with CSS
With Tailwind CSS 4, the theme can also be written in CSS. Pass it with thetheme prop, and your
own utilities with the utility prop:
Custom components
Tailwind classes on plain elements are inlined once the email is rendered, including the elements rendered by components of your own, so these work insideTailwind without any changes.
When a component needs the resolved styles while it renders, like Button does to compute its
Outlook fallbacks from the padding, use useTailwind(). Outside of Tailwind, it only normalizes
class and style.
badge.ts
Live example
Tailwind Demo
See the full demo and source code.
Support
All components were tested using the most popular email clients.Known limitations
Responsive and other non-inlinable classes need a <head>
Responsive and other non-inlinable classes need a <head>
Styles that can’t be inlined, like media queries (Those styles only apply on the email clients that support
sm:, md:), pseudo-classes (hover:, focus:)
and dark:, are added to a <style> tag in the <head> of the email, and the classes are kept on
the elements with email-safe names (sm:p-8 becomes sm_p-8).That’s why Head needs to be inside of Tailwind when you use them. If it
isn’t, rendering throws an error that lists the classes that need a <head>:<style> tags.No inlining for selectors that match more than a class
No inlining for selectors that match more than a class
Only rules that look an element up by its classes get inlined. Utilities that resolve into
relatively complex selectors, like the
space-* utilities
or prose from @tailwindcss/typography, use pseudo-classes such as :where() and :not(),
so they go into the <head> too, instead of being inlined, and don’t work on email clients that
don’t support <style> tags.HTML inserted with v-html gets its classes inlined too
HTML inserted with v-html gets its classes inlined too
Vue renders the HTML you insert with
v-html (or innerHTML) like the rest of the template, so
Tailwind can’t tell it apart: the classes of its elements get inlined too. React Email leaves
raw HTML alone, so if you rely on that, keep the classes out of the HTML you insert.