Skip to content

Commit

Permalink
fix(lit): add css part pseudo-element (#295)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Kane <[email protected]>
  • Loading branch information
eshlox and ascorbic authored Jul 13, 2023
1 parent 1917632 commit 86f9ebc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/src/content/img/lit.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,14 @@ You can then use the component in your HTML:
alt="A lovely bath"
></unpic-img>
```

## Styling

If you need to style the `img` element, you can use the
[`::part` pseudo-element](https://developer.mozilla.org/en-US/docs/Web/CSS/::part):

```css
unpic-img::part(image) {
border-radius: 4px;
}
```
11 changes: 11 additions & 0 deletions packages/lit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,15 @@ You can then use the component in your HTML:
></unpic-img>
```

## Styling

If you need to style the `img` element, you can use the
[`::part` pseudo-element](https://developer.mozilla.org/en-US/docs/Web/CSS/::part):

```css
unpic-img::part(image) {
border-radius: 4px;
}
```

For the supported props, see [the docs](https://unpic.pics/img/lit).
1 change: 1 addition & 0 deletions packages/lit/src/unpic-img.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class UnpicImg

return html`
<img
part="image"
src="${transformedProps.src}"
alt="${transformedProps.alt}"
width="${transformedProps.width}"
Expand Down

0 comments on commit 86f9ebc

Please sign in to comment.