Skip to content

Feedback ​

Telling users what happened: alerts, callouts and toasts.

INFO

Every component also has the common methods (key, visible, class, attributes, view…).

Alert ​

alert

Inline alert message; can be dismissible and carry action buttons.

php
use Cg\ComponentFramework\Component\Alert\Alert;

Alert::make('資料已儲存。')
    ->title('完成')
    ->success()
    ->dismissible();

Constructor:Alert::make(Htmlable|Closure|string $message)

All methods (11)
  • message(Htmlable|Closure|string $message)
  • title(Htmlable|Closure|string|null $title)
  • type(NotifyType|string $type)
  • success()
  • info()
  • warning()
  • danger()
  • icon(Icon|string|null $icon)
  • actions(Actions|Traversable|array $actions)
  • dismissible(bool $condition = true, string $label = '關閉通知')
  • visibilityState(string $key)

Callout ​

callout

Highlighted block for notes, caveats or reminders.

php
use Cg\ComponentFramework\Component\Callout\Callout;

Callout::make('這個功能還在測試,資料可能被重置。')
    ->title('Beta')
    ->warning();

Constructor:Callout::make(Htmlable|Closure|string $message)

All methods (11)
  • message(Htmlable|Closure|string $message)
  • title(Htmlable|Closure|string|null $title)
  • type(NotifyType|string $type)
  • success()
  • info()
  • warning()
  • danger()
  • icon(Icon|string|null $icon)
  • actions(Actions|Traversable|array $actions)
  • dismissible(bool $condition = true, string $label = '關閉通知')
  • visibilityState(string $key)

Toast ​

toast notification

Floating notification that disappears after a few seconds.

php
use Cg\ComponentFramework\Component\Toast\Toast;

Toast::make('已複製到剪貼簿')
    ->success()
    ->timeout(3000);

Constructor:Toast::make(Htmlable|Closure|string $message)

All methods (15)
  • id(string $id)
  • timeout(int $milliseconds)
  • delay(int $milliseconds)
  • stay(bool $closeable = true)
  • message(Htmlable|Closure|string $message)
  • title(Htmlable|Closure|string|null $title)
  • type(NotifyType|string $type)
  • success()
  • info()
  • warning()
  • danger()
  • icon(Icon|string|null $icon)
  • actions(Actions|Traversable|array $actions)
  • dismissible(bool $condition = true, string $label = '關閉通知')
  • visibilityState(string $key)

Generated from source by scripts/wiki-components/generate.php; every example is rendered as part of the build.