Skip to content

狀態與流程 ​

進度與載入狀態。

INFO

所有元件都能用共用方法(key、visible、class、attributes、view…)。

ProgressBar ​

progress-bar

進度條,可顯示數值與單位。

php
use Cg\ComponentFramework\Component\ProgressBar\ProgressBar;

ProgressBar::make('上傳進度')
    ->value(72)
    ->showValue()
    ->color('success');

建構:ProgressBar::make(Closure|string $label = '處理進度')

可用選項

  • color():primary · success · warning · danger · info
  • size():sm · md · lg
方法一覽 (8)
  • color(string $color)
  • size(string $size)
  • showLabel(bool $condition = true)
  • label(Closure|string $label)
  • value(Closure|int|float|null $value)
  • range(int|float $min, int|float $max)
  • showValue(Closure|bool $condition = true)
  • unit(string $suffix, string $prefix = '')

ProgressIndicator ​

progress-indicator

環形進度指示,可自訂範圍。

php
use Cg\ComponentFramework\Component\ProgressIndicator\ProgressIndicator;

ProgressIndicator::make('完成度')
    ->range(0, 5)
    ->value(3)
    ->showValue()
    ->size('lg');

建構:ProgressIndicator::make(Closure|string $label = '處理進度')

可用選項

  • color():primary · success · warning · danger · info
  • size():sm · md · lg · xl
方法一覽 (7)
  • color(string $color)
  • size(string $size)
  • label(Closure|string $label)
  • value(Closure|int|float|null $value)
  • range(int|float $min, int|float $max)
  • showValue(Closure|bool $condition = true)
  • unit(string $suffix, string $prefix = '')

Skeleton ​

skeleton loading

載入中的佔位骨架。

php
use Cg\ComponentFramework\Component\Skeleton\Skeleton;

Skeleton::make('載入文章')
    ->lines(3)
    ->animation('wave');

建構:Skeleton::make(string $label = '載入中')

可用選項

  • shape():text · rectangle · circle
  • animation():pulse · wave · none
方法一覽 (6)
  • label(string $label)
  • shape(string $shape)
  • animation(string $animation)
  • dimensions(string|int|float $width, string|int|float|null $height = null)
  • lines(int $lines)
  • decorative(bool $condition = true)

Spinner ​

spinner loading

旋轉的載入指示。

php
use Cg\ComponentFramework\Component\Spinner\Spinner;

Spinner::make('儲存中')->size('sm')->color('primary');

建構:Spinner::make(string $label = '載入中')

可用選項

  • color():current · primary · success · warning · danger · info
  • size():xs · sm · md · lg · xl
方法一覽 (4)
  • label(string $label)
  • color(string $color)
  • size(string $size)
  • decorative(bool $condition = true)

Stepper ​

stepper workflow

步驟指示,顯示流程進行到哪一步。

php
use Cg\ComponentFramework\Component\Stepper\Step;
use Cg\ComponentFramework\Component\Stepper\Stepper;

Stepper::make([
    Step::make('cart', '購物車')->complete(),
    Step::make('pay', '付款')->current(),
    Step::make('done', '完成'),
]);

建構:Stepper::make(iterable $steps = [])

可用選項

  • orientation():horizontal · vertical
方法一覽 (6)
  • steps(iterable $steps)
  • push(Step $step)
  • label(string $label)
  • orientation(string $orientation)
  • active(?string $key)
  • numbered(bool $condition = true)

這一頁由 scripts/wiki-components/generate.php 依原始碼產生,範例都經過實際渲染驗證。