Skip to content

Commit 83e449e

Browse files
authored
fix: double close button in docs (#1717)
* fix: double close button in docs * fix: typo in docs * rewording docs * docs update
1 parent 6e9efb7 commit 83e449e

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

src/routes/docs/components/drawer.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Use the Drawer component (or “off-canvas”) to show a fixed element relative
1919

2020
```svelte example hideOutput
2121
<script>
22-
import { Drawer, CardPlaceholder, Button, CloseButton } from "flowbite-svelte";
22+
import { Drawer, CardPlaceholder, Button } from "flowbite-svelte";
2323
import { sineIn } from "svelte/easing";
2424
</script>
2525
```
@@ -30,7 +30,7 @@ Since `Drawer` component extend Svelte's `HTMLAttributes<HTMLDivElement>`, you c
3030

3131
```svelte example
3232
<script>
33-
import { Drawer, CardPlaceholder, Button, CloseButton } from "flowbite-svelte";
33+
import { Drawer, CardPlaceholder, Button } from "flowbite-svelte";
3434
import { InfoCircleSolid, ArrowRightOutline } from "flowbite-svelte-icons";
3535
import { sineIn } from "svelte/easing";
3636
let open = $state(false);
@@ -62,7 +62,7 @@ Use this example to show a navigational sidebar inside the drawer component.
6262

6363
```svelte example
6464
<script>
65-
import { Drawer, CardPlaceholder, Button, CloseButton, Sidebar, SidebarWrapper, SidebarDropdownWrapper, SidebarGroup, SidebarItem } from "flowbite-svelte";
65+
import { Drawer, CardPlaceholder, Button, Sidebar, SidebarWrapper, SidebarDropdownWrapper, SidebarGroup, SidebarItem } from "flowbite-svelte";
6666
import { ChartPieSolid, CartSolid, GridSolid, MailBoxSolid, UsersSolid, ShoppingBagSolid, ArrowRightToBracketOutline, EditOutline } from "flowbite-svelte-icons";
6767
let open2 = $state(false);
6868
let spanClass = "flex-1 ms-3 whitespace-nowrap";
@@ -138,7 +138,7 @@ Use this example to show a contact form inside the drawer component.
138138

139139
```svelte example
140140
<script>
141-
import { Drawer, CardPlaceholder, Button, CloseButton, Label, Input, Textarea, P, A, Checkbox } from "flowbite-svelte";
141+
import { Drawer, CardPlaceholder, Button, Label, Input, Textarea, P, A, Checkbox } from "flowbite-svelte";
142142
import { InfoCircleSolid } from "flowbite-svelte-icons";
143143
144144
let open3 = $state(false);
@@ -182,7 +182,7 @@ Use this example if you want to add form elements inside the drawer component in
182182

183183
```svelte example
184184
<script>
185-
import { Drawer, CardPlaceholder, Button, CloseButton, Label, Input, Textarea } from "flowbite-svelte";
185+
import { Drawer, CardPlaceholder, Button, Label, Input, Textarea } from "flowbite-svelte";
186186
import { InfoCircleSolid, UserAddOutline, CalendarEditSolid } from "flowbite-svelte-icons";
187187
188188
let open4 = $state(false);
@@ -193,12 +193,9 @@ Use this example if you want to add form elements inside the drawer component in
193193
<CardPlaceholder size="2xl" class="mt-6" />
194194
</div>
195195
<Drawer bind:open={open4}>
196-
<div class="flex items-center justify-between">
197-
<h5 class="mb-6 inline-flex items-center text-base font-semibold text-gray-500 uppercase dark:text-gray-400">
198-
<InfoCircleSolid class="me-2.5 h-5 w-5" />New event
199-
</h5>
200-
<CloseButton class="mb-4 dark:text-white" />
201-
</div>
196+
<h5 class="mb-6 inline-flex items-center text-base font-semibold text-gray-500 uppercase dark:text-gray-400">
197+
<InfoCircleSolid class="me-2.5 h-5 w-5" />New event
198+
</h5>
202199
<form method="dialog" class="mb-6">
203200
<div class="mb-6">
204201
<Label for="title" class="mb-2 block">Title</Label>
@@ -244,7 +241,7 @@ Use the placement prop to position the drawer component either on the top, right
244241

245242
```svelte example
246243
<script>
247-
import { Drawer, CardPlaceholder, Button, CloseButton, Label, Textarea } from "flowbite-svelte";
244+
import { Drawer, CardPlaceholder, Button, Label, Textarea } from "flowbite-svelte";
248245
import { InfoCircleSolid, ArrowRightOutline } from "flowbite-svelte-icons";
249246
250247
let open5 = $state(false);
@@ -278,7 +275,7 @@ Set the `transitionParams` variable to new variables.
278275

279276
```svelte example
280277
<script>
281-
import { Drawer, CardPlaceholder, Button, CloseButton } from "flowbite-svelte";
278+
import { Drawer, CardPlaceholder, Button } from "flowbite-svelte";
282279
import { InfoCircleSolid, ArrowRightOutline } from "flowbite-svelte-icons";
283280
import { sineIn } from "svelte/easing";
284281
@@ -316,7 +313,7 @@ Use this example to show the drawer on the top side of the page.
316313

317314
```svelte example
318315
<script>
319-
import { Drawer, CardPlaceholder, Button, CloseButton, A } from "flowbite-svelte";
316+
import { Drawer, CardPlaceholder, Button, A } from "flowbite-svelte";
320317
import { InfoCircleSolid, ArrowRightOutline } from "flowbite-svelte-icons";
321318
import { sineIn } from "svelte/easing";
322319
@@ -351,7 +348,7 @@ Use this example to show the drawer on the bottom side of the page.
351348

352349
```svelte example
353350
<script>
354-
import { Drawer, CardPlaceholder, Button, CloseButton, A } from "flowbite-svelte";
351+
import { Drawer, CardPlaceholder, Button, A } from "flowbite-svelte";
355352
import { InfoCircleSolid, ArrowRightOutline } from "flowbite-svelte-icons";
356353
import { sineIn } from "svelte/easing";
357354
@@ -385,15 +382,21 @@ Use this example to show the drawer on the bottom side of the page.
385382

386383
The backdrop element can be used to dim out the background elements when the drawer is visible and also automatically hide the component when clicking outside of it.
387384

388-
Use the drawer's `backdrop:xxx` class to manage it's look.
385+
Use Tailwind's `backdrop:` variant classes (e.g., `backdrop:bg-black/50`) to style the dialog backdrop. For example:
386+
387+
```svelte
388+
<Drawer class="backdrop:bg-black/50">
389+
<!-- content -->
390+
</Drawer>
391+
```
389392

390393
## Non-modal
391394

392-
Drawer by default is `modal` (see `dialog`). You can set prop `modal={false}` to open `Drawer` in non-modal mode, that means with no backdrop. Note howerver, that you will need managed the `Drawer` position, z-index and `Esc` button manually.
395+
Drawer is `modal` by default (see `dialog`). You can set `modal={false}` to open `Drawer` in non-modal mode (no backdrop). However, you will need to manage the `Drawer` position, z-index, closing outside and `ESC` key behavior manually.
393396

394397
```svelte example
395398
<script>
396-
import { Drawer, CardPlaceholder, Button, CloseButton, A } from "flowbite-svelte";
399+
import { Drawer, CardPlaceholder, Button, A } from "flowbite-svelte";
397400
import { InfoCircleSolid, ArrowRightOutline } from "flowbite-svelte-icons";
398401
399402
let openNonModal = $state(false);
@@ -425,7 +428,7 @@ As the default, the drawer closes when you click the outside of the drawer. Howe
425428

426429
```svelte example
427430
<script>
428-
import { Drawer, CardPlaceholder, Button, CloseButton } from "flowbite-svelte";
431+
import { Drawer, CardPlaceholder, Button } from "flowbite-svelte";
429432
import { InfoCircleSolid, ArrowRightOutline } from "flowbite-svelte-icons";
430433
431434
let openDisablingOnlyOutsideClick = $state(false);

src/routes/docs/forms/timepicker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ Use this example to show multiple time interval selections inside of a drawer co
413413

414414
```svelte example class="flex justify-center p-4" hideResponsiveButtons
415415
<script lang="ts">
416-
import { Button, Drawer, Label, Select, Toggle, Checkbox, Timepicker, Card, P, Heading, Span, CloseButton } from "flowbite-svelte";
416+
import { Button, Drawer, Label, Select, Toggle, Checkbox, Timepicker, Card, P, Heading, Span } from "flowbite-svelte";
417417
import { InfoCircleSolid, ClockSolid, PlusOutline, TrashBinSolid, CloseOutline } from "flowbite-svelte-icons";
418418
419419
let open = $state(false);

0 commit comments

Comments
 (0)