Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Copy link

@github-actions github-actions bot Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/CalendarCompat 4 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/CalendarCompat.multiDayView.default.chromium_1.png 403 Changed
vr-tests-react-components/CalendarCompat.multiDayView - Dark Mode.default.chromium.png 1107 Changed
vr-tests-react-components/CalendarCompat.multiDayView.default.chromium.png 495 Changed
vr-tests-react-components/CalendarCompat.multiDayView - High Contrast.default.chromium.png 1236 Changed
vr-tests-react-components/Charts-DonutChart 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Charts-DonutChart.Dynamic.default.chromium.png 5581 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 497 Changed
vr-tests-react-components/Positioning.Positioning end.chromium.png 605 Changed
vr-tests-react-components/TagPicker 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - Dark Mode.disabled input hover.chromium.png 658 Changed
vr-tests-react-components/TagPicker.disabled - High Contrast.disabled input hover.chromium.png 1319 Changed
vr-tests-react-components/TagPicker.disabled - RTL.disabled input hover.chromium.png 635 Changed

There were 4 duplicate changes discarded. Check the build logs for more information.

"type": "minor",
"comment": "feat: add base hooks for Input",
"packageName": "@fluentui/react-input",
"email": "dmytrokirpa@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
import type { ComponentProps, ComponentState, DistributiveOmit, Slot } from '@fluentui/react-utilities';

export type InputSlots = {
/**
Expand Down Expand Up @@ -106,11 +106,22 @@ export type InputProps = Omit<
| 'week';
};

/**
* Input props without design-specific props (appearance, size).
* Use this when building a base input that is unstyled or uses a custom design system.
*/
export type InputBaseProps = DistributiveOmit<InputProps, 'appearance' | 'size'>;

/**
* State used in rendering Input.
*/
export type InputState = Required<Pick<InputProps, 'appearance' | 'size'>> & ComponentState<InputSlots>;

/**
* Input state without design-specific state (appearance, size).
*/
export type InputBaseState = DistributiveOmit<InputState, 'appearance' | 'size'>;

/**
* Data passed to the `onChange` callback when a user changes the input's value.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
export { Input } from './Input';
export type { InputOnChangeData, InputProps, InputSlots, InputState } from './Input.types';
export type {
InputBaseProps,
InputBaseState,
InputOnChangeData,
InputProps,
InputSlots,
InputState,
} from './Input.types';
export { renderInput_unstable } from './renderInput';
export { useInput_unstable } from './useInput';
export { useInput_unstable, useInputBase_unstable } from './useInput';
export { inputClassNames, useInputStyles_unstable } from './useInputStyles.styles';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react';
import { useFieldControlProps_unstable } from '@fluentui/react-field';
import { getPartitionedNativeProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';
import type { InputProps, InputState } from './Input.types';
import type { InputBaseProps, InputBaseState, InputProps, InputState } from './Input.types';
import { useOverrides_unstable as useOverrides } from '@fluentui/react-shared-contexts';

/**
Expand All @@ -20,7 +20,7 @@ export const useInput_unstable = (props: InputProps, ref: React.Ref<HTMLInputEle

const overrides = useOverrides();

const { size = 'medium', appearance = overrides.inputDefaultAppearance ?? 'outline', onChange } = props;
const { size = 'medium', appearance = overrides.inputDefaultAppearance ?? 'outline', ...baseProps } = props;

if (
process.env.NODE_ENV !== 'production' &&
Expand All @@ -33,6 +33,25 @@ export const useInput_unstable = (props: InputProps, ref: React.Ref<HTMLInputEle
);
}

const state = useInputBase_unstable(baseProps, ref);

return {
size,
appearance,
...state,
};
};

/**
* Base hook for Input component, which manages state related to controlled/uncontrolled value,
* slot structure, and onChange handling. This hook excludes design-specific props (appearance, size).
*
* @param props - User provided props to the Input component.
* @param ref - User provided ref to be passed to the Input component.
*/
export const useInputBase_unstable = (props: InputBaseProps, ref: React.Ref<HTMLInputElement>): InputBaseState => {
const { onChange } = props;

const [value, setValue] = useControllableState({
state: props.value,
defaultState: props.defaultValue,
Expand All @@ -42,12 +61,10 @@ export const useInput_unstable = (props: InputProps, ref: React.Ref<HTMLInputEle
const nativeProps = getPartitionedNativeProps({
props,
primarySlotTagName: 'input',
excludedPropNames: ['size', 'onChange', 'value', 'defaultValue'],
excludedPropNames: ['onChange', 'value', 'defaultValue'],
});

const state: InputState = {
size,
appearance,
const state: InputBaseState = {
components: {
root: 'span',
input: 'input',
Expand Down
4 changes: 4 additions & 0 deletions packages/react-components/react-input/library/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
export { Input, inputClassNames, renderInput_unstable, useInputStyles_unstable, useInput_unstable } from './Input';
export type { InputOnChangeData, InputProps, InputSlots, InputState } from './Input';

// Experimental APIs - will be uncommented in the experimental release branch
// export { useInputBase_unstable } from './Input';
// export type { InputBaseProps, InputBaseState } from './Input';