组件
- 手风琴
- 警报
- 警报对话框
- 纵横比
- 头像
- 徽章
- 面包屑
- 按钮
- 按钮组
- 日历
- 卡片
- 轮播
- 图表
- 复选框
- 可折叠
- 组合框
- 命令
- 上下文菜单
- 数据表格
- 日期选择器
- 对话框
- 方向
- 抽屉
- 下拉菜单
- 空
- 字段
- 悬停卡
- 输入
- 输入组
- 输入 OTP
- 条目
- 键盘
- 标签
- 菜单栏
- 原生选择
- 导航菜单
- 分页
- 弹出窗口
- 进度
- 单选按钮组
- 可调整大小
- 滚动区域
- 选择
- 分隔符
- 工作表
- 侧边栏
- 骨架
- 滑块
- Sonner
- 旋转器
- 切换
- 表格
- 标签
- 文本区域
- Toast
- 切换
- 切换组
- 工具提示
- 排版
- 手风琴
- 警报
- 警报对话框
- 纵横比
- 头像
- 徽章
- 面包屑
- 按钮
- 按钮组
- 日历
- 卡片
- 轮播
- 图表
- 复选框
- 可折叠
- 组合框
- 命令
- 上下文菜单
- 数据表格
- 日期选择器
- 对话框
- 方向
- 抽屉
- 下拉菜单
- 空
- 字段
- 悬停卡
- 输入
- 输入组
- 输入 OTP
- 条目
- 键盘
- 标签
- 菜单栏
- 原生选择
- 导航菜单
- 分页
- 弹出窗口
- 进度
- 单选按钮组
- 可调整大小
- 滚动区域
- 选择
- 分隔符
- 工作表
- 侧边栏
- 骨架
- 滑块
- Sonner
- 旋转器
- 切换
- 表格
- 标签
- 文本区域
- Toast
- 切换
- 切换组
- 工具提示
- 排版
DirectionProvider 组件用于设置应用的文本方向(ltr 或 rtl)。这对于支持像阿拉伯语、希伯来语和波斯语这样的从右向左的语言是必不可少的。
🌐 The DirectionProvider component is used to set the text direction (ltr or rtl) for your application. This is essential for supporting right-to-left languages like Arabic, Hebrew, and Persian.
以下是组件在从右到左模式下的预览。使用语言选择器切换语言。要查看更多示例,请在组件页面上查找 RTL 部分。
🌐 Here's a preview of the component in RTL mode. Use the language selector to switch the language. To see more examples, look for the RTL section on components pages.
تسجيل الدخول إلى حسابك
أدخل بريدك الإلكتروني أدناه لتسجيل الدخول إلى حسابك
安装
🌐 Installation
pnpm dlx shadcn@latest add direction
用法
🌐 Usage
import { DirectionProvider } from "@/components/ui/direction"<html dir="rtl">
<body>
<DirectionProvider direction="rtl">
</DirectionProvider>
</body>
</html>useDirection
useDirection 钩子用于获取应用的当前方向。
🌐 The useDirection hook is used to get the current direction of the application.
import { useDirection } from "@/components/ui/direction"
function MyComponent() {
const direction = useDirection()
return <div>Current direction: {direction}</div>
}