Primitives
The smallest building blocks: icons, headings, images, labels and layout.
INFO
Every component also has the common methods (key, visible, class, attributes, view…).
Icon
icon svg symbolBuilt-in SVG icon. Without a label it is treated as decorative and hidden from screen readers.
use Cg\ComponentFramework\Component\Icon\Icon;
Icon::make('check')->size('lg')->label('完成');Constructor:Icon::make(Closure|string $name)
Options
size():xs·sm·md·lg·xl
All methods (2)
size(string $size)label(?string $label)
Heading
heading title typographyHeading text; the semantic level (h1–h6) and the visual size are set independently.
use Cg\ComponentFramework\Component\Heading\Heading;
Heading::make('季度報告')
->level(2)
->size('xl')
->description('2026 Q4 營運摘要');Constructor:Heading::make(Htmlable|Closure|string $content)
Options
size():xs·sm·md·lg·xl·2xl
All methods (3)
level(int $level)size(?string $size)description(?string $description)
Image
image media pictureImage with required alt text; supports dimensions, object-fit and eager loading.
use Cg\ComponentFramework\Component\Image\Image;
Image::make('/images/cover.jpg', '產品封面')
->dimensions(960, 540)
->fit('cover');Constructor:Image::make(Closure|string $source, Closure|string $alt = '')
Options
fit():contain·cover·fill·none·scale-down
All methods (3)
dimensions(?int $width, ?int $height)fit(string $fit)eager(bool $condition = true)
Badge
badge tag labelSmall status label for categories, states or counts.
use Cg\ComponentFramework\Component\Badge\Badge;
Badge::make('已上線')->color('success')->icon('check');Constructor:Badge::make(Htmlable|Closure|string $label)
Options
color():neutral·primary·success·warning·danger·infosize():sm·md·lg
All methods (4)
color(string $color)size(string $size)icon(Icon|string|null $icon)rounded(bool $condition = true)
Label
label formForm label; binds to a field id, marks required fields, or can be visually hidden.
use Cg\ComponentFramework\Component\Label\Label;
Label::make('電子郵件', 'email')->required();Constructor:Label::make(Htmlable|Closure|string $content, ?string $for = null)
All methods (3)
for(?string $id)required(bool $condition = true)visuallyHidden(bool $condition = true)
Separator
separator dividerDivider line with an optional centered label; horizontal or vertical.
use Cg\ComponentFramework\Component\Separator\Separator;
Separator::make('或');Constructor:Separator::make(Closure|string|null $label = null)
Options
orientation():horizontal·vertical
All methods (1)
orientation(string $orientation)
Stack
stack layoutLayout container that arranges children by direction, gap and alignment.
use Cg\ComponentFramework\Component\Badge\Badge;
use Cg\ComponentFramework\Component\Stack\Stack;
Stack::make([
Badge::make('PHP'),
Badge::make('Laravel')->color('primary'),
])->direction('row')->gap('sm')->wrap();Constructor:Stack::make(iterable $components = [])
Options
direction():row·columngap():none·xs·sm·md·lg·xlalign():start·center·end·stretch·baselinejustify():start·center·end·between·around·evenly
All methods (7)
components(iterable $components)push(Component $component)direction(string $direction)gap(string $gap)align(string $align)justify(string $justify)wrap(bool $condition = true)
Generated from source by scripts/wiki-components/generate.php; every example is rendered as part of the build.