Skip to content

Commit db4a6dd

Browse files
committed
docs: fix: zipPattern escape \
1 parent ae13dd5 commit db4a6dd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/routes/docs/forms/number-input.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Use this example with an icon and helper text to set a ZIP code value inside a f
3838
<script lang="ts">
3939
import { Input, Label, P } from "flowbite-svelte";
4040
import { MapPinAltSolid } from "flowbite-svelte-icons";
41+
const zipPattern = "^\\d{5}(-\\d{4})?$";
4142
</script>
4243
4344
<form class="max-w-sm mx-auto">
@@ -46,7 +47,7 @@ Use this example with an icon and helper text to set a ZIP code value inside a f
4647
<div class="absolute inset-y-0 start-0 top-0 flex items-center ps-3.5 pointer-events-none">
4748
<MapPinAltSolid />
4849
</div>
49-
<Input type="text" pattern="^\d{5}(-\d{4})?$" title="Enter ZIP code: 12345 or 12345-6789" inputmode="numeric" placeholder="12345 or 12345-6789" class="ps-10" aria-describedby="helper-text-explanation" required />
50+
<Input type="text" pattern={zipPattern} title="Enter ZIP code: 12345 or 12345-6789" inputmode="numeric" placeholder="12345 or 12345-6789" class="ps-10" aria-describedby="helper-text-explanation" required />
5051
</div>
5152
<P id="helper-text-explanation" class="mt-2 text-sm" >Enter either a standard 5-digit ZIP code or the extended ZIP+4.</P>
5253
</form>

0 commit comments

Comments
 (0)