-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
// SPDX-FileCopyrightText: 2024 Shota FUJI <pockawoooh@gmail.com>
// SPDX-License-Identifier: AGPL-3.0-only
import { Text, type TextProps } from "@radix-ui/themes";
import { type FC, type ReactNode } from "react";
export interface DescriptionProps extends Omit<TextProps, "as" | "size"> {
/**
* エラーとして表示するメッセージ。
* このプロパティが表示される場合はこちらを優先して表示し、見た目も
* エラーとわかりやすい状態になる。
*/
error?: ReactNode;
}
export const Description: FC<DescriptionProps> = ({
error,
children,
color = "gray",
...rest
}) => {
return (
<Text {...rest} as="span" size="1" color={error ? "red" : color}>
{error || children}
</Text>
);
};