snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
58
apps/v4/examples/base/input-rtl.tsx
Normal file
58
apps/v4/examples/base/input-rtl.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
|
||||
import {
|
||||
useTranslation,
|
||||
type Translations,
|
||||
} from "@/components/language-selector"
|
||||
import {
|
||||
Field,
|
||||
FieldDescription,
|
||||
FieldLabel,
|
||||
} from "@/styles/base-nova/ui-rtl/field"
|
||||
import { Input } from "@/styles/base-nova/ui-rtl/input"
|
||||
|
||||
const translations: Translations = {
|
||||
en: {
|
||||
dir: "ltr",
|
||||
values: {
|
||||
apiKey: "API Key",
|
||||
placeholder: "sk-...",
|
||||
description: "Your API key is encrypted and stored securely.",
|
||||
},
|
||||
},
|
||||
ar: {
|
||||
dir: "rtl",
|
||||
values: {
|
||||
apiKey: "مفتاح API",
|
||||
placeholder: "sk-...",
|
||||
description: "مفتاح API الخاص بك مشفر ومخزن بأمان.",
|
||||
},
|
||||
},
|
||||
he: {
|
||||
dir: "rtl",
|
||||
values: {
|
||||
apiKey: "מפתח API",
|
||||
placeholder: "sk-...",
|
||||
description: "מפתח ה-API שלך מוצפן ונשמר בצורה מאובטחת.",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export function InputRtl() {
|
||||
const { dir, t } = useTranslation(translations, "ar")
|
||||
|
||||
return (
|
||||
<Field dir={dir}>
|
||||
<FieldLabel htmlFor="input-rtl-api-key">{t.apiKey}</FieldLabel>
|
||||
<Input
|
||||
id="input-rtl-api-key"
|
||||
type="password"
|
||||
placeholder={t.placeholder}
|
||||
dir={dir}
|
||||
/>
|
||||
<FieldDescription>{t.description}</FieldDescription>
|
||||
</Field>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user