docs(ui-docs): add code example and explain responsive behavior

This commit is contained in:
upsiflu 2025-01-20 19:08:12 +02:00
parent 541eca9c90
commit d20744bb70
1 changed files with 21 additions and 3 deletions

View File

@ -19,7 +19,7 @@ Place the `Header` at the beginning of a page. Choose an appropriate heading lev
<Header h1="My title" />
## Add an image
### Add an image
Use the `<template #image>` slot to place a picture to the left of the header.
@ -27,8 +27,18 @@ Use the `<template #image>` slot to place a picture to the left of the header.
<Header h1="My title">
<template #image>
<img
style="width: 196px;"
src="https://images.unsplash.com/photo-1524650359799-842906ca1c06?ixlib=rb-1.2.1&dl=te-nguyen-Wt7XT1R6sjU-unsplash.jpg&w=640&q=80&fm=jpg&crop=entropy&cs=tinysrgb" />
</template>
<div style="height: 48px;">
My subtitle
</div>
<Layout flex gap-8>
<Button outline square>A</Button>
<Button outline square>B</Button>
<Spacer h grow />
<Button outline square>C</Button>
</Layout>
</Header>
```
@ -49,6 +59,14 @@ Use the `<template #image>` slot to place a picture to the left of the header.
</Layout>
</Header>
## Add an action to the right of the heading
::: tip Responsive layout:
-> Use the `action` prop [which is the same as in the `Section` component](/components/ui/layout/section).
On narrow screens, the header will first wrap between image and title/content area.
Make sure to keep the minimum width of the title and the content area narrow to prevent unnecessary wrapping.
:::
### Add an action to the right of the heading
-> Use the `action` prop [which is the same as in the `Section` component](/components/ui/layout/section#provide-an-action).