Actions
Things users click. All share the action methods (color, size, icon, modal toggles, Linker calls).
INFO
Every component also has the common methods (key, visible, class, attributes, view…).
Button
buttonButton. Submits forms, toggles client state, opens/closes modals, or calls a Linker method.
use Cg\ComponentFramework\Component\Button\Button;
Button::make('儲存')
->type('submit')
->color('primary')
->icon('check');Constructor:Button::make(Htmlable|Closure|string $label)
Options
type():button·submit·resetcolor():neutral·primary·success·warning·danger·infosize():sm·md·lgvariant():solid·outline·ghost
All methods (3)
type(string $type)name(?string $name)value(string|int|float|bool|null $value)
All shared action methods are also available.
ButtonGroup
button-groupGroups several buttons or links, optionally attached together.
use Cg\ComponentFramework\Component\ButtonGroup\ButtonGroup;
use Cg\ComponentFramework\Component\Button\Button;
ButtonGroup::make([
Button::make('日'),
Button::make('週'),
Button::make('月'),
])->attached()->label('檢視範圍');Constructor:ButtonGroup::make(iterable $actions = [])
Options
orientation():horizontal·vertical
All methods (5)
actions(iterable $actions)push(ActionComponent $action)orientation(string $orientation)attached(bool $condition = true)label(?string $label)
DropdownMenu
dropdown-menuDropdown menu that tucks secondary actions behind one button.
use Cg\ComponentFramework\Component\Button\Button;
use Cg\ComponentFramework\Component\DropdownMenu\DropdownMenu;
use Cg\ComponentFramework\Component\Link\Link;
DropdownMenu::make('更多動作', [
Link::make('編輯', '/posts/1/edit'),
Button::make('刪除')->color('danger'),
])->placement('end')->variant('outline');Constructor:DropdownMenu::make(Htmlable|Closure|string $label, iterable $actions = [])
Options
placement():start·endwidth():sm·md·lgcolor():neutral·primary·success·warning·danger·infosize():sm·md·lgvariant():solid·outline·ghost
All methods (5)
actions(iterable $actions)push(ActionComponent $action)placement(string $placement)width(string $width)open(bool $condition = true)
All shared action methods are also available.
Link
linkLink that can look like a button; supports new tab, download and rel.
use Cg\ComponentFramework\Component\Link\Link;
Link::make('查看文件', 'https://example.com/docs')
->newTab()
->icon('chevron-right', 'after');Constructor:Link::make(Htmlable|Closure|string $label, Closure|string $url = '#')
Options
target():_self·_blank·_parent·_topcolor():neutral·primary·success·warning·danger·infosize():sm·md·lgvariant():solid·outline·ghost
All methods (4)
target(string $target)newTab(bool $condition = true)rel(array|string $relations)download(string|bool $download = true)
All shared action methods are also available.
Generated from source by scripts/wiki-components/generate.php; every example is rendered as part of the build.