Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99135e6
commit a64c105
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Bulleted list item | ||
|
||
## Create empty item | ||
|
||
```php | ||
$item = BulletedListItem::create(); | ||
``` | ||
|
||
## Create from string | ||
|
||
Bulleted list items can be created from simple strings. | ||
|
||
```php | ||
$item = BulletedListItem::fromString("Item content"); | ||
|
||
echo $item->toString(); // "Item content" | ||
``` | ||
|
||
## Create from `RichText` | ||
|
||
```php | ||
$text = RichText::createText("Item text")->italic(); | ||
|
||
$item = BulletedListItem::create()->withText($text); | ||
``` | ||
|
||
## Add text | ||
|
||
```php | ||
$item = BulletedListItem::fromString("Item text"); | ||
$item = $item->withText( | ||
RichText::createText(" can be extended!") | ||
); | ||
|
||
echo $item->toString(); // "Item text can be extended!" | ||
``` | ||
|
||
## Add child | ||
|
||
```php | ||
$item = BulletedListItem::fromString("Item text"); | ||
|
||
$item = $item->appendChild( | ||
Paragraph::fromString("A simple child paragraph.") | ||
); | ||
``` | ||
|
||
## Change children | ||
|
||
```php | ||
$item = BulletedListItem::fromString("Item text"); | ||
|
||
$item = $item->withChildren( | ||
Paragraph::fromString("Child paragraph 1"), | ||
Paragraph::fromString("Child paragraph 2"), | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters