增加一个用于给其他组件添加Label的组件。

This commit is contained in:
徐涛 2025-01-07 05:56:33 +08:00
parent 54d46a353f
commit 8e12f9f74a
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,16 @@
@layer components {
.labeled {
width: 100%;
display: flex;
flex-direction: column;
align-items: stretch;
gap: var(--spacing-xs);
label {
width: 100%;
display: flex;
flex-direction: row;
align-items: baseline;
font-size: var(--font-size-xs);
}
}
}

View File

@ -0,0 +1,15 @@
import styles from './Labeled.module.css';
type LabeledProps = {
label: string;
children: React.ReactNode;
};
export function Labeled({ label, children }: LabeledProps) {
return (
<div className={styles.labeled}>
<label>{label}</label>
{children}
</div>
);
}