Skip to content

Commit

Permalink
docs: add example for pasteTransformer and update latest sponsors
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermerodz committed Feb 7, 2025
1 parent 79ce1d1 commit 618f50e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<h3 align="center">Hero Sponsors 🎖️</h3>
<p align="center">
<a href="https://resend.com" target="_blank">
<a href="https://go.resend.com/input-otp" target="_blank">
<img alt="Resend" src='https://input-otp.rodz.dev/sponsors/resend-wordmark-white-in-black-bg.svg' width="130" style="aspect-ratio: auto;"/>
</a>
</p>

<!-- <h3 align="center">Hero Sponsors</h3>
<a href="https://resend.com" target="_blank" style="display: flex; justify-content: center; align-items: center; background-color: #000; width: 150px; height: 150px; border-radius: 8px; margin: 0 auto;">
<a href="https://go.resend.com/input-otp" target="_blank" style="display: flex; justify-content: center; align-items: center; background-color: #000; width: 150px; height: 150px; border-radius: 8px; margin: 0 auto;">
<img alt="Resend" src='https://input-otp.rodz.dev/sponsors/resend-wordmark-white.svg' width="120px" style="aspect-ratio: auto;"/>
</a> -->

Expand Down Expand Up @@ -360,6 +360,19 @@ const { control } = useForm();
```
</details>

<details>
<summary>Paste-transformers</summary>
If you want to allow pasting of "XXX-XXX" even though the input's regex/pattern doesn't allow hyphen and its max length is 6, you can use the `pasteTransformer` prop.

```tsx
<OTPInput
// Transform the pasted text to parse hyphens but remove hyphens,
// so it fits into the input's pattern and max length.
pasteTransformer={(pasted) => pasted.replaceAll('-', '')}
/>
```
</details>

## Caveats

<details>
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/app/(pages)/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default async function IndexPage() {

<div className="mb-14 md:mb-20 lg:mb-20 lg:opacity-0 lg:animate-fade-up !duration-1000 ![animation-delay:3000ms] animate-none">
<h3 className="text-center text-xl font-bold">Hero Sponsors</h3>
<a className="relative size-[160px] flex items-center justify-center bg-muted/80 dark:bg-muted/20 rounded-xl mt-4 group" href="https://resend.com" target="_blank">
<a className="relative size-[160px] flex items-center justify-center bg-muted/80 dark:bg-muted/20 rounded-xl mt-4 group" href="https://go.resend.com/input-otp" target="_blank">
<div className="relative size-[65%] aspect-square group-hover:scale-110 transition-all duration-300 ease-out">
<Image
alt="Resend"
Expand Down

0 comments on commit 618f50e

Please sign in to comment.