Foundations

Size System

A unified Size enum with four values controls component dimensions consistently across every Sillium.Core.Blazor component. Combined with ComponentStyleHelper, it maps semantic sizes to precise Tailwind CSS classes.

Overview

The Size enum defines four values: Small, Medium, Large, and ExtraLarge. Every component that supports sizing accepts this enum, ensuring consistent dimensions across the entire component library. Medium is the default for all components.

Show code
public enum Size
{
    Small,
    Medium,
    Large,
    ExtraLarge
}

Live Size Comparison

See all four sizes rendered side by side on real components. Each component reads the Size parameter and resolves it to the appropriate Tailwind CSS classes via ComponentStyleHelper.

Buttons
Text Inputs

Pixel Mapping Table

Each Size value maps to specific Tailwind CSS utility classes. The table below shows the exact class and pixel value for each aspect at every size level.

Aspect Small Medium Large ExtraLarge
Component Height (non-Text) min-h-9 (36px) min-h-11 (44px) min-h-12 (48px) min-h-14 (56px)
Component Height (Text variant) min-h-8 (32px) min-h-10 (40px) min-h-11 (44px) min-h-12 (48px)
Input Font Size text-sm (14px) text-sm (14px) text-base (16px) text-base (16px)
Action Button h-3.5 w-3.5 (14px) h-4 w-4 (16px) h-5 w-5 (20px) h-6 w-6 (24px)

ComponentStyleHelper Methods

ComponentStyleHelper is a static class that centralizes all size-to-CSS mappings. Components call these methods internally so you never need to write Tailwind classes for sizing manually.

GetSizeClass

Returns the overall min-height and padding classes. Accounts for the Text variant which uses a reduced height and minimal horizontal padding.

Show code
public static string GetSizeClass(Variant variant, Size size) => size switch
{
    Size.Small     => variant == Variant.Text ? "min-h-8 px-0.5 py-0.5" : "min-h-9 px-2.5 py-1",
    Size.Large     => variant == Variant.Text ? "min-h-11 px-0.5 py-1.5" : "min-h-12 px-3.5 py-2.5",
    Size.ExtraLarge=> variant == Variant.Text ? "min-h-12 px-0.5 py-2"   : "min-h-14 px-4 py-3",
    _              => variant == Variant.Text ? "min-h-10 px-0.5 py-1"   : "min-h-11 px-3 py-2"
};
GetInputSizeClass

Returns the font-size class for input text. Small and Medium use text-sm (14px), Large and ExtraLarge use text-base (16px).

Show code
public static string GetInputSizeClass(Size size) => size switch
{
    Size.Small     => "text-sm",
    Size.Large     => "text-base",
    Size.ExtraLarge=> "text-base",
    _              => "text-sm"
};
GetActionButtonSizeClass

Returns the width and height classes for action icons like clear buttons. Scales from 14px (Small) to 24px (ExtraLarge).

Show code
public static string GetActionButtonSizeClass(Size size) => size switch
{
    Size.Small     => "h-3.5 w-3.5",
    Size.Large     => "h-5 w-5",
    Size.ExtraLarge=> "h-6 w-6",
    _              => "h-4 w-4"
};

Breakpoint Enum

The Breakpoint enum controls responsive layout behavior. Components like Split and Sidebar use it to determine at which screen width to collapse from a multi-column to a single-column layout. The None value disables collapsing entirely.

Show code
public enum Breakpoint
{
    None,
    Small,
    Medium,
    Large,
    ExtraLarge
}

Pass a Breakpoint value to layout components via CollapseAt or similar parameters. For example, CollapseAt="Breakpoint.Large" makes a Split component stack vertically on screens narrower than the large breakpoint.

File Reference

The size system is implemented across these source files in the Sillium.Core.Blazor library.

File Purpose
Models/Size.cs Size enum definition (Small, Medium, Large, ExtraLarge)
Models/Breakpoint.cs Breakpoint enum definition (None, Small, Medium, Large, ExtraLarge)
Helpers/ComponentStyleHelper.cs Static helper methods mapping Size values to Tailwind CSS classes
An unhandled error has occurred. Reload Dismiss