Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(design): add `className` props to `Input` (#1569)

白熱b73df3f0558d
diff --git a/packages/design/src/components/input/Input.tsx b/packages/design/src/components/input/Input.tsx
index ddd5cfb356..2395a7f933 100644
--- a/packages/design/src/components/input/Input.tsx
+++ b/packages/design/src/components/input/Input.tsx
@@ -22,8 +22,17 @@ import React from 'react';
import styles from './index.module.less';
export interface IInputProps {
+ /**
+ * Whether the input is autoFocus
+ * @default false
+ */
autoFocus?: boolean;
+ /**
+ * The input class name
+ */
+ className?: string;
+
/**
* The input affix wrapper style
*/
@@ -85,7 +94,9 @@ export interface IInputProps {
export function Input(props: IInputProps) {
const {
affixWrapperStyle,
+ autoFocus = false,
type = 'text',
+ className,
placeholder,
value,
size = 'middle',
@@ -94,7 +105,6 @@ export function Input(props: IInputProps) {
onClick,
onKeyDown,
onChange,
- autoFocus,
} = props;
function handleChange(e: React.ChangeEvent<HTMLInputElement>) {
@@ -102,7 +112,7 @@ export function Input(props: IInputProps) {
onChange?.(value);
}
- const _className = clsx({
+ const _className = clsx(className, {
[styles.inputAffixWrapperMini]: size === 'mini',
[styles.inputAffixWrapperSmall]: size === 'small',
[styles.inputAffixWrapperMiddle]: size === 'middle',