Styling
Tailwind CSS
A guide on installing and using the Tailwind CSS plugin.
If you’re a fan of Tailwind CSS like we are, then you really don’t want to be forced to create
a .css
file to handle random outlier cases. It not only slows you down and breaks your flow, but
it also goes against all the advantages of using utility classes. Our Tailwind
plugin provides you with media variants such as media-paused:opacity-0
to help you easily style
elements based on media state.
Installation
Section titled InstallationYou can register the plugin by adding the following to tailwind.config.js
:
The following options are available:
Usage
Section titled UsageThe Tailwind plugin provides media variants which can be used to prefix utilities so they’re applied when a given media state is active (or not). Here are some examples:
Media Variants
Section titled Media VariantsPlayback
Section titled PlaybackView Type
Section titled View TypeStream Type
Section titled Stream TypeRemote Playback
Section titled Remote PlaybackNot Variants
Section titled Not VariantsAll media variants can be prefixed with not-
to negate the selector. Classes with this prefix
will be transformed into media-player:not([state])
selectors.
Few more examples:
not-media-paused
: Media is in the play state (not paused).not-media-playing
: Media playback is not active (not playing).not-media-can-play
: Media is not ready for playback (not can play).
Data Attributes
Section titled Data AttributesData attributes are applied to components throughout the library to expose internal state for styling purposes. Tailwind supports data attributes out of the box to apply styles conditionally.
All component API references include the exposed data attributes. See the player data attributes as an example.
Focus
Section titled FocusThe data-focus
attribute is applied to all components when focused via keyboard. This attribute
can be used to apply focus styling like so:
Hocus
Section titled HocusThe data-hocus
attribute is applied to components when they’re being keyboard focused or
hovered on by a pointer device. This attribute is applied to help keep class lists concise and
can be used like so: