StepItem
API reference › Bootstrap 6 › item › StepItem
Represents a Stepper step: a list item, a <div>, or a link when it has a URL.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$active readonly constructor | bool | Whether the step is completed or current (.active). Default: false. | StepItem |
$description readonly constructor | string|Stringable| | Secondary text rendered under the label, or null for none. Default: null. | StepItem |
$encode readonly constructor | bool| | Whether to HTML-encode $label and $description, or null to use Stepper::$encodeLabels. Default: null. | StepItem |
$label readonly constructor | string|Stringable | Label of the step. | StepItem |
$options readonly constructor | array<array-key, | HTML attributes of the .stepper-item element. Default: []. | StepItem |
$theme readonly constructor | yii2\| | Theme color rendered as the theme-{value} class, or null for the default. Default: null. | StepItem |
$url readonly constructor | array<array-key, | URL processed by Url::to(), or null for a step without link; any step with a URL renders the stepper as links. Default: null. | StepItem |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
fromArray() static | Creates a step from the array configuration documented in Stepper::$items. | StepItem |
to() static | Creates a step. | StepItem |
withActive() | Returns a copy with the given active state. | StepItem |
withDescription() | Returns a copy with the given description. | StepItem |
withEncode() | Returns a copy with the given encoding flag. | StepItem |
withLabel() | Returns a copy with the given label. | StepItem |
withOptions() | Returns a copy with the given .stepper-item attributes. | StepItem |
withTheme() | Returns a copy with the given theme color. | StepItem |
withUrl() | Returns a copy with the given URL. | StepItem |
Method details
Section titled “Method details”fromArray()
Section titled “fromArray() ”public static function fromArray(array<array-key, mixed> $config): selfCreates a step from the array configuration documented in Stepper::$items.
Only true activates the step and only a bool encode is used; a description, theme, url, or
options of another type is ignored.
Parameters
| Parameter | Type | Description |
|---|---|---|
$config | array<array-key, | Step configuration. |
Returns
self
Throws
yii\base\InvalidConfigException: if the step has nostring|Stringablelabel, or itsthemeis astringthat is not aThemevalue.
public static function to(string|Stringable $label, string|Stringable|null $description = null): selfCreates a step.
Parameters
| Parameter | Type | Description |
|---|---|---|
$label | string|Stringable | Label of the step. |
$description | string|Stringable| | Secondary text rendered under the label, or null for none. |
Returns
self
withActive()
Section titled “withActive() ”public function withActive(bool $active): selfReturns a copy with the given active state.
Parameters
| Parameter | Type | Description |
|---|---|---|
$active | bool |
Returns
self
withDescription()
Section titled “withDescription() ”public function withDescription(string|Stringable|null $description): selfReturns a copy with the given description.
withEncode()
Section titled “withEncode() ”public function withEncode(bool|null $encode): selfReturns a copy with the given encoding flag.
Parameters
| Parameter | Type | Description |
|---|---|---|
$encode | bool| |
Returns
self
withLabel()
Section titled “withLabel() ”public function withLabel(string|Stringable $label): selfReturns a copy with the given label.
withOptions()
Section titled “withOptions() ”public function withOptions(array<array-key, mixed> $options): selfReturns a copy with the given .stepper-item attributes.
Parameters
| Parameter | Type | Description |
|---|---|---|
$options | array<array-key, | HTML attributes of the .stepper-item element. |
Returns
self
withTheme()
Section titled “withTheme() ”public function withTheme(yii2\extensions\bootstrap6\enum\Theme|string|null $theme): selfReturns a copy with the given theme color.
Parameters
| Parameter | Type | Description |
|---|---|---|
$theme | yii2\| |
Returns
self
Throws
yii\base\InvalidConfigException: if$themeis astringthat is not aThemevalue.
withUrl()
Section titled “withUrl() ”public function withUrl(array<array-key, mixed>|string|null $url): selfReturns a copy with the given URL.
Parameters
| Parameter | Type | Description |
|---|---|---|
$url | array<array-key, | URL processed by Url::to(). |
Returns
self