Skip to content

Core Classes ​

The shared base (Node → Component → Action/Field), the four contracts, the Schema/Page/Cluster composition layer, and the Catalog and chart-driver extension points.

Node ​

abstract class

Cg\ComponentFramework\Component\Node

Implements:RenderableNode、Htmlable

MethodReturnsNotes
attribute(string $name, mixed $value = true)static
attributes(array $attributes)static
attributesHtml(array $defaults = [], array $except = [])HtmlString
attributeTokens(string $name, array|string $tokens)static把 ARIA idref、rel 等空白分隔 token 安全附加到既有屬性。
class(array|string $classes)static
getAttribute(string $name, mixed $default = null)mixed
getView()string
hidden(Closure|bool $condition = true)static
interactionAttributes()HtmlString
isVisible()bool
key(?string $key = null)static|string|null不帶參數=讀取 key;帶參數=設定 key 並回傳自己(可串接)。
linker(string $alias, array $params = [])static
nodeType()string
render()HtmlString
renderAuto(string $controller, string $method = 'components', array $params = [], array $extra = [])static頁面載入後自動向 controller 要內容,取代這個節點裡面的 HTML(等同 Blade 的 @renderAuto)。 節點裡原本的內容就是載入前的佔位,通常放 Skeleton:
renderBlade(string $controller, string $method = 'components', array $params = [], ?string $target = null, array $extra = [])static
renderObject(string $name, array $allow = ['render'])static
stateless(string $alias)static
toHtml()string
toView()View
view(string $view)static
visible(Closure|bool $condition = true)static
withViewData(array $data)static

Component ​

abstract class

Cg\ComponentFramework\Component\Component

最小 UI 節點。所有具體元件都由這裡開始。

Extends:Node · Implements:Htmlable、RenderableNode

Inherited methods (23)

from Node:attribute attributes attributesHtml attributeTokens class getAttribute getView hidden interactionAttributes isVisible key linker nodeType render renderAuto renderBlade renderObject stateless toHtml toView view visible withViewData

Action ​

abstract class

Cg\ComponentFramework\Component\Action\Action

Extends:Component → Node · Implements:Htmlable、RenderableNode、ActionComponent

Constants (allowed values)

  • COLORS:neutral · primary · success · warning · danger · info
  • SIZES:sm · md · lg
  • VARIANTS:solid · outline · ghost
MethodReturnsNotes
closesModal(string $key)static
color(string $color)static
disabled(Closure|bool $condition = true)static
icon(Icon|Closure|string|null $icon, string $position = 'before')static
iconOnly(?string $accessibleLabel = null)static
linkerCall(string $method, array|string|null $args = null, array $extra = [], array|string|null $confirm = null, string $on = 'click', ?int $debounce = null, bool $prevent = true)static呼叫最近一層 Linker host。參數直接交給既有 LinkerAttributes 驗證, Component 層不建立另一種 binding wire format。
static make(Htmlable|Closure|string $label)static
opensModal(string $key)static
size(string $size)static
stateSet(string $key, mixed $value)static
stateToggle(string $key)static
variant(string $variant)static
Inherited methods (23)

from Node:attribute attributes attributesHtml attributeTokens class getAttribute getView hidden interactionAttributes isVisible key linker nodeType render renderAuto renderBlade renderObject stateless toHtml toView view visible withViewData

Field ​

abstract class

Cg\ComponentFramework\Component\Field\Field

Extends:Component → Node · Implements:Htmlable、RenderableNode、FieldComponent

MethodReturnsNotes
disabled(Closure|bool $condition = true)static
error(Closure|string|null $message, string $bag = 'default')static
errorBag(string $bag)static
getId()string
getName()string
helperText(Closure|string|null $text)static
id(?string $id)static
label(Htmlable|Closure|string|null $label)static
linkerCall(string $method, array|string|null $args = null, array $extra = [], array|string|null $confirm = null, string $on = 'click', ?int $debounce = null, bool $prevent = true)static呼叫最近一層 Linker host。參數直接交給既有 LinkerAttributes 驗證, Component 層不建立另一種 binding wire format。
live(string $method, array|string|null $args = null, ?int $debounce = 300, array $extra = [])static
readOnly(Closure|bool $condition = true)static
required(Closure|bool $condition = true)static
state(string $key)static
Inherited methods (23)

from Node:attribute attributes attributesHtml attributeTokens class getAttribute getView hidden interactionAttributes isVisible key linker nodeType render renderAuto renderBlade renderObject stateless toHtml toView view visible withViewData

RenderableNode ​

interface

Cg\ComponentFramework\Component\Contracts\RenderableNode

Implements:Htmlable

MethodReturnsNotes
key(?string $key = null)static|string|null不帶參數=讀取 key;帶參數=設定 key 並回傳自己(可串接)。
nodeType()string
render()HtmlString
toHtml()—Get content as a string of HTML.

ActionComponent ​

interface

Cg\ComponentFramework\Component\Contracts\ActionComponent

Marker contract:只有可被使用者操作的元件才能進入 Actions Schema。

Implements:RenderableNode、Htmlable

MethodReturnsNotes
key(?string $key = null)static|string|null不帶參數=讀取 key;帶參數=設定 key 並回傳自己(可串接)。
nodeType()string
render()HtmlString
toHtml()—Get content as a string of HTML.

FieldComponent ​

interface

Cg\ComponentFramework\Component\Contracts\FieldComponent

Marker contract:可提交或參與表單狀態的輸入元件。

Implements:RenderableNode、Htmlable

MethodReturnsNotes
key(?string $key = null)static|string|null不帶參數=讀取 key;帶參數=設定 key 並回傳自己(可串接)。
nodeType()string
render()HtmlString
toHtml()—Get content as a string of HTML.

RequiresMultipart ​

interface

Cg\ComponentFramework\Component\Contracts\RequiresMultipart

元件本身或其後代需要由 multipart/form-data 表單提交。

Implements:RenderableNode、Htmlable

MethodReturnsNotes
key(?string $key = null)static|string|null不帶參數=讀取 key;帶參數=設定 key 並回傳自己(可串接)。
nodeType()string
render()HtmlString
requiresMultipart()bool
toHtml()—Get content as a string of HTML.

Schema ​

class

Cg\ComponentFramework\Schema\Schema

Extends:Node · Implements:Htmlable、RenderableNode · View:cg-schema::SchemaView

MethodReturns
components(iterable $components)static
getComponents()NodeCollection
static make(iterable $components = [])static
push(Component $component)static
schemaType()string
Inherited methods (23)

from Node:attribute attributes attributesHtml attributeTokens class getAttribute getView hidden interactionAttributes isVisible key linker nodeType render renderAuto renderBlade renderObject stateless toHtml toView view visible withViewData

Form ​

final class not extendable

Cg\ComponentFramework\Schema\Form

Extends:Schema → Node · Implements:RenderableNode、Htmlable · View:cg-schema::SchemaView

MethodReturns
action(?string $action)static
csrf(bool $condition = true)static
static make(iterable $components = [])static
method(string $method)static
multipart(bool $condition = true)static
novalidate(bool $condition = true)static
Inherited methods (27)

from Node:attribute attributes attributesHtml attributeTokens class getAttribute getView hidden interactionAttributes isVisible key linker nodeType render renderAuto renderBlade renderObject stateless toHtml toView view visible withViewData

from Schema:components getComponents push schemaType

Entries ​

final class not extendable

Cg\ComponentFramework\Schema\Entries

Extends:Schema → Node · Implements:RenderableNode、Htmlable · View:cg-schema::SchemaView

MethodReturns
static make(iterable $components = [])static
Inherited methods (27)

from Node:attribute attributes attributesHtml attributeTokens class getAttribute getView hidden interactionAttributes isVisible key linker nodeType render renderAuto renderBlade renderObject stateless toHtml toView view visible withViewData

from Schema:components getComponents push schemaType

Actions ​

final class not extendable

Cg\ComponentFramework\Schema\Actions

Extends:Schema → Node · Implements:RenderableNode、Htmlable · View:cg-schema::SchemaView

MethodReturns
static make(iterable $components = [])static
Inherited methods (27)

from Node:attribute attributes attributesHtml attributeTokens class getAttribute getView hidden interactionAttributes isVisible key linker nodeType render renderAuto renderBlade renderObject stateless toHtml toView view visible withViewData

from Schema:components getComponents push schemaType

Page ​

class

Cg\ComponentFramework\Page\Page

Extends:Node · Implements:Htmlable、RenderableNode · View:cg-page::PageView

MethodReturns
getSchemas()NodeCollection
getSlug()string
getTitle()string
getUrl()?string
static make(Closure|string $title)static
push(Schema $schema)static
schemas(iterable $schemas)static
slug(?string $slug)static
url(?string $url)static
Inherited methods (23)

from Node:attribute attributes attributesHtml attributeTokens class getAttribute getView hidden interactionAttributes isVisible key linker nodeType render renderAuto renderBlade renderObject stateless toHtml toView view visible withViewData

Cluster ​

class

Cg\ComponentFramework\Cluster\Cluster

Extends:Node · Implements:Htmlable、RenderableNode · View:cg-cluster::ClusterView

MethodReturnsNotes
activePage(?string $key, bool $render = true)staticSelect one page and opt in to rendering it below the cluster navigation.
getLabel()string
getPages()NodeCollection
getSlug()string
static make(Closure|string $label)static
page(string $key)?Page
pages(iterable $pages)static
push(Page $page)static
renderActivePage(bool $condition = true)static
slug(?string $slug)static
Inherited methods (23)

from Node:attribute attributes attributesHtml attributeTokens class getAttribute getView hidden interactionAttributes isVisible key linker nodeType render renderAuto renderBlade renderObject stateless toHtml toView view visible withViewData

ComponentCatalog ​

final class not extendable

Cg\ComponentFramework\Component\Catalog\ComponentCatalog

MethodReturns
all(ComponentCategory|string|null $category = null)array
count()int
find(string $id)?ComponentDefinition
get(string $id)ComponentDefinition
grouped()array
has(string $id)bool
register(ComponentDefinition $definition, bool $replace = false)self
registerMany(iterable $definitions, bool $replace = false)self
search(string $query)array

ComponentDefinition ​

final class not extendable

Cg\ComponentFramework\Component\Catalog\ComponentDefinition

MethodReturns
category()ComponentCategory
componentClass()string
description()string
static fromArray(string $id, array $definition)self
id()string
isAction()bool
isField()bool
label()string
package()string
since()string
tags()array
toArray()array

ComponentCategory ​

enum

Cg\ComponentFramework\Component\Catalog\ComponentCategory

Cases:Primitive = primitive · Action = action · Field = field · Data = data · Feedback = feedback · Navigation = navigation · Status = status · Content = content · Overlay = overlay · Structure = structure · Accessibility = accessibility

MethodReturns
label()string
static resolve(self|string $category)self

ChartDriverManager ​

final class not extendable

Cg\ComponentFramework\Component\Chart\ChartDriverManager

Chart 驅動註冊表(容器 singleton;對外請用 Facade ChartDrivers)。

MethodReturnsNotes
default()string
extend(string $name, ChartDriver|Closure|string $driver)staticregister() 的舊名稱。
static forgetRegistrations()void測試用:清掉所有排隊中的註冊。
get(string $name)ChartDriver
has(string $name)bool
names()array
origin(string $name)?string驅動註冊在哪裡(內建、config 或檔案:行號),除錯用。
static queue(string $name, ChartDriver|Closure|string $driver, bool $replace = false)void不需要容器也能呼叫(例如 bootstrap 階段);效果與 register()/replace() 相同。
register(string $name, ChartDriver|Closure|string $driver)static註冊新驅動;同名已存在(內建、config 或其他呼叫)會丟例外。
replace(string $name, ChartDriver|Closure|string $driver)static明確覆蓋既有驅動(例如換掉內建的 amcharts)。
setDefault(string $name)static

Generated from source by scripts/wiki-components/generate.php via reflection. Do not edit by hand.