Theme Raed uses TailwindCSS as its utility-first CSS framework. This guide covers the TailwindCSS configuration, custom theme extensions, and how to customize styles.
Configuration files
TailwindCSS configuration is split across two files:
tailwind.config.js - Main TailwindCSS configuration
postcss.config.js - PostCSS pipeline configuration
Content sources
Tailwind scans these files to generate CSS classes:
content : [
"src/views/**/*.twig" ,
"src/assets/js/**/*.js" ,
'node_modules/@salla.sa/twilight-tailwind-theme/safe-list-css.txt'
]
All Twig template files Tailwind scans these for class names to generate
All JavaScript files Includes classes added dynamically via JavaScript
Salla theme safelist Ensures Salla-specific classes are always included
Dark mode
Theme Raed uses class-based dark mode. Add the dark class to enable dark mode:
< html class = "dark" >
<!-- Dark mode active -->
</ html >
Container configuration
container : {
center : true ,
padding : '10px' ,
screens : {
'2xl' : "1280px"
}
}
Automatically center containers using margin auto
Default horizontal padding for containers
Maximum container width for 2xl breakpoint Prevents containers from becoming too wide on large screens
Typography
Font families
fontFamily : {
sans : [
'var(--font-main)' ,
'-apple-system' ,
'BlinkMacSystemFont'
],
primary : "var(--font-main)"
}
Font stack:
Custom font via CSS variable (--font-main)
System fonts as fallback
Usage:
< div class = "font-sans" > Uses main font </ div >
< div class = "font-primary" > Also uses main font </ div >
Font sizes
fontSize : {
'icon-lg' : '33px' ,
'xxs' : '10px' ,
'xxxs' : '8px' ,
'title-size' : '42px' ,
'22px' : '22px'
}
Custom sizes:
Large icon text size Usage: text-icon-lg
Extra extra small text Usage: text-xxs
Extra extra extra small text Usage: text-xxxs
Large title text size Usage: text-title-size
Line heights
lineHeight : {
'12' : '3rem' ,
'14' : '3.5rem' ,
'16' : '4rem' ,
'18' : '4.5rem' ,
'20' : '5rem'
}
Usage:
< h1 class = "text-title-size leading-16" > Large heading </ h1 >
Colors
Custom colors
colors : {
'dark' : '#1D1F1F' ,
'darker' : '#0E0F0F' ,
'danger' : '#AE0A0A' ,
'primary-dark' : 'var(--color-primary-dark)'
}
Dark background color Usage: bg-dark, text-dark, border-dark
Darker background color for layered dark mode Usage: bg-darker
Danger/error state color Usage: bg-danger, text-danger, border-danger
primary-dark
color
default: "var(--color-primary-dark)"
Dark variant of primary color via CSS variable Usage: bg-primary-dark
Spacing
Custom spacing values
spacing : {
'3.75' : '15px' ,
'7.5' : '30px' ,
'58' : '232px' ,
'62' : '248px' ,
'100' : '28rem' ,
'116' : '464px' ,
'132' : '528px' ,
'200' : '800px'
}
Usage examples:
< div class = "p-3.75" > 15px padding </ div >
< div class = "mt-7.5" > 30px top margin </ div >
< div class = "w-116" > 464px width </ div >
< div class = "max-w-200" > 800px max width </ div >
Border radius
borderRadius : {
'large' : '22px' ,
'big' : '40px' ,
'tiny' : '3px' ,
DEFAULT : '.75rem'
}
Large border radius Usage: rounded-large
Extra large border radius for pills Usage: rounded-big
Minimal border radius Usage: rounded-tiny
Default border radius when using rounded Usage: rounded
Box shadows
boxShadow : {
'default' : '5px 10px 30px #2B2D340D;' ,
'top' : '0px 0px 10px #0000001A;' ,
'md' : '5px 10px 99px #2B2D340D' ,
'dropdown' : '0 4px 8px rgba(161, 121, 121, 0.07)' ,
'light' : '0px 4px 15px rgba(1, 1, 1, 0.06)' ,
'huge' : '0px 3px 6px #00000029' ,
'progress' : '0 5px 15px rgba(92, 213, 196, 0.4)' ,
'mobile' : 'rgb(0 0 0 / 9%) 0px 2px 1px, ...'
}
Usage:
< div class = "shadow-default" > Standard card shadow </ div >
< div class = "shadow-dropdown" > Dropdown menu shadow </ div >
< div class = "shadow-light" > Subtle shadow </ div >
< div class = "shadow-huge" > Prominent shadow </ div >
Dimensions
Width
width : {
'18' : '4.5rem' ,
'22' : '5.5rem' ,
'74' : '18.5rem' ,
'76' : '19rem' ,
'78' : '19.5rem'
}
Height
height : {
'banner' : '200px' ,
'lg-banner' : '428px' ,
'full-banner' : '600px' ,
'500' : '500px' ,
'460' : '460px'
}
Banner heights:
< div class = "h-banner" > 200px height </ div >
< div class = "h-lg-banner" > 428px height </ div >
< div class = "h-full-banner" > 600px height </ div >
Min/max width
minWidth : {
'1/4' : '25%' ,
'1/2' : '50%' ,
'3/4' : '75%'
},
maxWidth : {
'1/4' : '25%' ,
'1/2' : '50%' ,
'3/4' : '75%'
}
Usage:
< div class = "min-w-1/2 max-w-3/4" > Constrained width </ div >
Grid system
gridTemplateColumns : {
'auto-fill' : 'repeat(auto-fill, 290px)'
}
Creates a responsive grid that automatically fits 290px columns:
< div class = "grid grid-cols-auto-fill gap-4" >
< div > Card 1 </ div >
< div > Card 2 </ div >
< div > Card 3 </ div >
</ div >
Breakpoints
screens : {
'xxs' : { 'min' : '380px' , 'max' : '479px' },
'xs' : '480px'
}
Custom breakpoints:
Extra extra small devices (380px - 479px) Usage: xxs:text-sm
Extra small devices (480px and up) Usage: xs:block
Standard breakpoints (from Tailwind):
sm: 640px
md: 768px
lg: 1024px
xl: 1280px
2xl: 1280px (custom max-width)
Animations
Keyframes
keyframes : {
slideUpFromBottom : {
'0%' : { transform: 'translateY(100%)' , opacity: '0' },
'100%' : { transform: 'translateY(0%)' , opacity: '1' }
},
slideDownFromBottom : {
'0%' : { transform: 'translateY(0%)' , opacity: '1' },
'100%' : { transform: 'translateY(100%)' , opacity: '0' }
}
}
Animation utilities
animation : {
slideUpFromBottom : 'slideUpFromBottom .6s linear' ,
slideDownFromBottom : 'slideDownFromBottom .6s linear'
}
Usage:
< div class = "animate-slideUpFromBottom" >
Slides up from bottom
</ div >
Transitions
Timing functions
transitionTimingFunction : {
'elastic' : 'cubic-bezier(0.55, 0, 0.1, 1)'
}
Usage:
< div class = "transition ease-elastic duration-300" >
Elastic transition
</ div >
Properties
transitionProperty : {
'height' : 'height'
}
Usage:
< div class = "transition-height duration-300" >
Animates height changes
</ div >
Z-index
zIndex : {
'1' : '1' ,
'2' : '2' ,
'-1' : '-1'
}
Usage:
< div class = "z-1" > Layer 1 </ div >
< div class = "z-2" > Layer 2 (above) </ div >
< div class = "z--1" > Behind base layer </ div >
Plugins
Salla Twilight theme
require ( '@salla.sa/twilight-tailwind-theme' )
Adds Salla-specific utilities and components including:
RTL support
Salla color scheme
Salla component styles
require ( '@tailwindcss/forms' )
Provides better default styles for form elements:
Input fields
Select dropdowns
Checkboxes and radios
Textareas
Line clamp
require ( '@tailwindcss/line-clamp' )
Enables truncating text to a specific number of lines:
< p class = "line-clamp-2" >
This text will be truncated to 2 lines with an ellipsis
</ p >
PostCSS configuration
The postcss.config.js file configures the CSS processing pipeline:
module . exports = {
plugins: {
'postcss-import' : {},
'tailwindcss/nesting' : 'postcss-nesting' ,
tailwindcss: {},
'postcss-preset-env' : {
features: { 'nesting-rules' : true }
}
}
}
Plugin pipeline
Processes @import statements in CSS files Allows splitting CSS into multiple files: @import './components/button.css' ;
@import './components/card.css' ;
Enables CSS nesting syntax .card {
&:hover {
@apply shadow-lg;
}
}
Main TailwindCSS plugin that generates utility classes
Adds modern CSS features with browser compatibility
CSS nesting
Custom properties
Modern color functions
Customization
Adding custom colors
Extend the color palette in tailwind.config.js:
theme : {
extend : {
colors : {
'brand' : '#FF6B6B' ,
'brand-light' : '#FFE5E5'
}
}
}
Adding custom utilities
Create custom utility classes:
const plugin = require ( 'tailwindcss/plugin' );
module . exports = {
plugins: [
plugin ( function ({ addUtilities }) {
const newUtilities = {
'.rtl-flip' : {
transform: 'scaleX(-1)'
}
}
addUtilities ( newUtilities )
})
]
}
Customizing breakpoints
Modify or add breakpoints:
theme : {
screens : {
'tablet' : '640px' ,
'laptop' : '1024px' ,
'desktop' : '1280px'
}
}
Important mode
Set to false to avoid adding !important to all utilities. This allows easier overriding when needed.
Only set important: true if you have specific CSS specificity conflicts that require it.
Best practices
Use semantic spacing - Prefer Tailwind’s spacing scale over arbitrary values
Leverage component classes - Use @apply for repeated patterns
Keep customizations minimal - Extend only when necessary
Use design tokens - Define colors and spacing as CSS variables
Optimize for production - Use PurgeCSS via content configuration
Follow RTL conventions - Use logical properties (start/end instead of left/right)
Test dark mode - Ensure all custom colors work in dark mode
Document custom utilities - Add comments explaining custom extensions
Tailwind automatically optimizes for production:
PurgeCSS - Removes unused classes based on content sources
Minification - CSS is minified in production builds
Tree shaking - Only includes used plugins and utilities
Production build size:
Development: ~3MB (all utilities)
Production: ~10-50KB (purged and minified)