Update readme
This commit is contained in:
15
README.md
15
README.md
@@ -16,7 +16,7 @@ Create badges from objects or as standalone elements.
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
# Badgeable interface
|
# Creating badges with `BadgeableInterface`
|
||||||
|
|
||||||
Any object that you would like to be able to be turned into a badge must implement `BadgeableInterface`.
|
Any object that you would like to be able to be turned into a badge must implement `BadgeableInterface`.
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public function getBadgeColour(): Badge
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
You then specify the object using the `obj` prop when rendering the badge:
|
You then specify the object using the `:obj` prop when rendering the badge:
|
||||||
|
|
||||||
```twig
|
```twig
|
||||||
{# job.html.twig #}
|
{# job.html.twig #}
|
||||||
@@ -74,7 +74,16 @@ obj="{{ job.kind }}"
|
|||||||
|
|
||||||
`outline` - A boolean attribute that changes the style of the badge to an outline.
|
`outline` - A boolean attribute that changes the style of the badge to an outline.
|
||||||
|
|
||||||
`class` - Extra classes you want to add to the badge element. These will override the base classes in case of conflicts.
|
`class` - Extra classes you want to add to the badge element. These are merged with the badge base classes taking priority in case of conflicts.
|
||||||
|
|
||||||
|
`label` - Badge label text. Content inside the content block will be prioritised over the label attribute if present.
|
||||||
|
```php
|
||||||
|
{# Both of these render the same markup. #}
|
||||||
|
|
||||||
|
<twig:Pcm:Badge colour="red" label="Warning!" />
|
||||||
|
|
||||||
|
<twig:Pcm:Badge colour="red">Warning!<twig:Pcm:Badge>
|
||||||
|
```
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user