Use when styling or laying out SyncFusion components. Critical for understanding what CSS classes exist vs don't exist. Prevents using fake utility classes that break layout...
Created: 2025-10-25 after 4h debugging session Source: SF official docs + verified icon list + ProjectDetailView implementation
SF HAR INGA Tailwind-liknande utility-klasser!
// Layout
e-flex, e-grid, e-inline, e-block
e-align-center, e-align-start, e-align-end
e-justify-between, e-justify-center, e-justify-start
e-flex-column, e-flex-row, e-flex-wrap
// Spacing
e-gap-4, e-gap-8, e-gap-12, e-gap-16, e-gap-24
e-m-0, e-m-4, e-m-8, e-mb-4, e-mb-8, e-mb-12, e-mb-16, e-mb-24
e-mt-4, e-mt-8, e-mt-16, e-mt-32
e-p-4, e-p-8, e-p-12, e-p-16, e-p-24, e-p-32
e-px-16, e-py-8
// Typography
e-text-xs, e-text-sm, e-text-base, e-text-lg, e-text-xl
e-font-normal, e-font-medium, e-font-semibold, e-font-bold
e-text-center, e-text-left, e-text-right
// Grid
e-grid-cols-2, e-grid-cols-3, e-grid-cols-4
Resultat om du använder dessa: Layout kollapsar helt, komponenter blir osynliga/felplacerade.
e-card // Card container
e-card-header // Card header
e-card-title // Header title
e-card-content // Card content area
e-btn // Base button
e-primary // Primary (blue)
e-success // Success (green)
e-danger // Danger (red)
e-warning // Warning (orange)
e-info // Info (blue)
e-outline // Outline style
e-flat // Flat style
e-small // Small button
e-icons // Base icon class
e-small // 8px
e-medium // 16px
e-large // 24px
// Verified icon names (517 total in fluent2.scss):
e-check, e-plus, e-close, e-warning, e-refresh
e-arrow-left, e-arrow-right, e-arrow-up, e-arrow-down
e-user, e-edit, e-trash, e-folder
e-clock, e-date-occurring
e-play, e-pause
Verifiera ikoner INNAN användning:
grep "e-your-icon" node_modules/@syncfusion/ej2-icons/styles/fluent2.scss
// âś… CORRECT
<div style={{
display: 'flex',
alignItems: 'center',
gap: '8px',
marginBottom: '16px'
}}>
{/* Content */}
</div>
// ❌ WRONG - Dessa klasser gör INGENTING
<div className="e-flex e-align-center e-gap-8 e-mb-16">
{/* Content */}
</div>
// ✅ CORRECT - Använd e-card för grupperad content
<div className="e-card">
<div className="e-card-header">
<div className="e-card-title">Rubrik</div>
</div>
<div className="e-card-content" style={{ padding: '12px' }}>
{/* Content med inline styles för layout */}
</div>
</div>
// ❌ WRONG - Custom divs med påhittade klasser
<div className="e-p-16 e-rounded-lg e-border">
<h3 className="e-mb-12">Rubrik</h3>
{/* Content */}
</div>
// âś… CORRECT - SF ButtonComponent
<ButtonComponent
cssClass="e-primary"
iconCss="e-icons e-check"
content="Spara"
onClick={handleSave}
/>
// ❌ WRONG - Native button (dålig styling, ingen ripple)
<button className="e-btn e-primary" onClick={handleSave}>
<span className="e-icons e-check"></span> Spara
</button>
ButtonComponent props:
cssClass: 'e-primary', 'e-success', 'e-danger', 'e-outline', 'e-flat', 'e-small'iconCss: 'e-icons e-iconname'iconPosition: 'Left' (default) eller 'Right'content: Text pĂĄ knappenonClick: Event handler// âś… CORRECT - Verified icon + size class
<span className="e-icons e-medium e-check"></span>
<span className="e-icons e-small e-user"></span>
// ❌ WRONG - Påhittad ikon + inline font-size
<span className="e-icons e-calendar" style={{ fontSize: '12px' }}></span>
Icon sizes:
e-small: 8pxe-medium: 16px (default om ingen size anges)e-large: 24pxVanliga ikoner (verifierade):
e-check, e-plus, e-close, e-edit, e-trashe-arrow-left, e-arrow-right, e-arrow-up, e-arrow-downe-warning, e-refresh, e-play, e-pausee-user, e-clock, e-date-occurring, e-folder// âś… CORRECT - SF official variables
color: 'var(--color-sf-primary)' // Primary blue
color: 'var(--color-sf-black)' // Black text
color: 'var(--color-sf-success)' // Green
color: 'var(--color-sf-warning)' // Orange
color: 'var(--color-sf-danger)' // Red
// Subtle text (opacity):
color: 'var(--color-sf-black)', opacity: 0.6 // Secondary text
color: 'var(--color-sf-black)', opacity: 0.4 // Tertiary text
// ❌ WRONG - Custom vars som inte finns
color: 'var(--e-text)'
color: 'var(--e-surface-hover)'
color: 'var(--primary-600)'
Tillgängliga SF Fluent2 CSS-variabler:
--color-sf-primary, --color-sf-primary-light, --color-sf-primary-dark--color-sf-black, --color-sf-white--color-sf-success, --color-sf-warning, --color-sf-danger, --color-sf-info--color-sf-border, --color-sf-border-light// âś… CORRECT - Inline styles
style={{
padding: '12px',
margin: '16px',
marginBottom: '12px',
gap: '8px'
}}
// ❌ WRONG - Påhittade klasser
className="e-p-12 e-m-16 e-mb-12 e-gap-8"
Kompakta värden (från ProjectDetailView):
// âś… CORRECT
style={{
fontSize: '11px', // Small labels
fontSize: '14px', // Normal text
fontSize: '16px', // Numbers/emphasis
fontSize: '20px', // Headings
fontSize: '24px', // Page title
fontWeight: 'bold',
fontWeight: '600'
}}
// ❌ WRONG
className="e-text-sm e-font-bold"
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
import { InPlaceEditorComponent } from '@syncfusion/ej2-react-inplace-editor';
import { SliderComponent } from '@syncfusion/ej2-react-inputs';
export function MyView() {
return (
<div style={{ maxWidth: '896px', margin: '0 auto', padding: '24px' }}>
{/* Navigation */}
<div style={{ marginBottom: '12px' }}>
<ButtonComponent
cssClass="e-flat e-small"
iconCss="e-icons e-arrow-left"
content="Tillbaka"
onClick={() => navigate(-1)}
/>
</div>
{/* Title + Metadata */}
<div style={{ marginBottom: '16px' }}>
<h1 style={{
fontSize: '24px',
fontWeight: 'bold',
margin: '0 0 4px 0',
color: 'var(--color-sf-black)'
}}>Sidtitel</h1>
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
<span className="e-icons e-small e-user"></span>
<span style={{ fontSize: '14px', color: 'var(--color-sf-black)', opacity: 0.6 }}>
Metadata
</span>
</div>
</div>
</div>
{/* Card with actions */}
<div className="e-card" style={{ marginBottom: '16px' }}>
<div className="e-card-header">
<div className="e-card-title">Sektion</div>
</div>
<div className="e-card-content" style={{ padding: '12px' }}>
<div style={{ display: 'flex', gap: '8px' }}>
<ButtonComponent
cssClass="e-primary"
iconCss="e-icons e-check"
content="Primär åtgärd"
/>
<ButtonComponent
cssClass="e-outline"
iconCss="e-icons e-close"
content="Avbryt"
/>
</div>
</div>
</div>
{/* Compact slider card */}
<div className="e-card">
<div className="e-card-content" style={{ padding: '6px 10px 4px 10px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '2px' }}>
<span style={{ fontSize: '11px', color: 'var(--color-sf-black)', opacity: 0.5 }}>
Label vänster
</span>
<span style={{ fontSize: '11px', color: 'var(--color-sf-black)', opacity: 0.5 }}>
Label höger
</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '6px' }}>
<span style={{ fontSize: '16px', fontWeight: 'bold', color: 'var(--color-sf-primary)' }}>
55%
</span>
<span style={{ fontSize: '16px', fontWeight: 'bold', color: 'var(--color-sf-primary-dark)' }}>
18h
</span>
</div>
<SliderComponent
min={0}
max={100}
type="MinRange"
tooltip={{ isVisible: true, placement: 'Before', showOn: 'Hover' }}
/>
</div>
</div>
</div>
);
}
className="e-mb-16" → STOP! Använd style={{ marginBottom: '16px' }}className="e-flex e-gap-8" → STOP! Använd style={{ display: 'flex', gap: '8px' }}e-calendar eller e-schedule → STOP! Verifiera i fluent2.scss FÖRST<button className="e-btn"> → STOP! Använd <ButtonComponent>var(--e-text) → STOP! Använd var(--color-sf-black) + opacitynode_modules/@syncfusion/ej2-icons/styles/fluent2.scssgrep "e-your-icon-name" node_modules/@syncfusion/ej2-icons/styles/fluent2.scss
grep -o "&\.e-[a-z-]*:" node_modules/@syncfusion/ej2-icons/styles/fluent2.scss | \
sed 's/&\.//' | sed 's/://' | sort -u
grep -E "^\s*--color-sf-" node_modules/@syncfusion/ej2-base/styles/fluent2.css | head -30
Card Padding:
6px 10px 4px 10px (progress slider)12px (standard card content)16px (selektivt)Margins:
12-16px16px4-8pxGaps:
4-6px8px12pxFont Sizes:
11px (opacity 0.5)12px14px16px16-20px20-24px<ButtonComponent
cssClass="e-primary" // Style
iconCss="e-icons e-check" // Icon
iconPosition="Left" // Left/Right
content="Knapptext" // Text
onClick={handler} // Handler
disabled={false} // State
/>
<SliderComponent
min={0}
max={100}
step={5}
value={50}
type="MinRange" // Visar fylld track!
tooltip={{
isVisible: true,
placement: 'Before',
showOn: 'Hover' // Inte 'Always'
}}
change={(e: any) => handleChange(e.value)}
/>
<InPlaceEditorComponent
mode="Inline"
type="Date" // Text, Numeric, Date
value={value}
emptyText="Placeholder"
actionOnBlur="Submit"
model={{ min: 0, step: 0.5, format: 'N1' }} // För Numeric
change={async (e: any) => {
await save(e.value);
}}
/>
// ❌ FEL - 4 timmar debugging
<div className="e-flex e-gap-8 e-mb-16">
<span className="e-text-sm e-font-bold">Text</span>
</div>
// Resultat: Ingen layout, text osynlig
// ✅ RÄTT
<div style={{ display: 'flex', gap: '8px', marginBottom: '16px' }}>
<span style={{ fontSize: '14px', fontWeight: 'bold' }}>Text</span>
</div>
// ❌ FEL - Ikonen finns inte
<span className="e-icons e-calendar"></span>
// Resultat: Tom fyrkant
// ✅ RÄTT - Verifiera FÖRST
<span className="e-icons e-medium e-date-occurring"></span>
// ❌ FEL - Ingen ripple, dålig styling
<button className="e-btn e-primary">Spara</button>
// ✅ RÄTT
<ButtonComponent cssClass="e-primary" content="Spara" />
// ❌ FEL - Variabeln finns inte
color: 'var(--e-text)'
color: 'var(--primary-600)'
// ✅ RÄTT - SF official variables
color: 'var(--color-sf-black)'
opacity: 0.6
Innan du börjar koda:
Under kodning:
Efter implementation:
Officiell dokumentation:
Projekt-referenser:
Verifiera innan användning:
# Lista alla ikoner
grep -o "&\.e-[a-z-]*:" node_modules/@syncfusion/ej2-icons/styles/fluent2.scss | \
sed 's/&\.//' | sed 's/://' | sort -u > /tmp/sf-icons.txt
# Kolla om ikon finns
grep "e-my-icon" /tmp/sf-icons.txt
Skill Version: 1.0 (Verified från 4h debugging-session) Skapad: 2025-10-25 Källa: SF official docs + verified implementation + learned mistakes Status: Production-ready