docs/react-v9/contributing/rfcs/convergence/apperance-migration.md
Fluent V9 changes the default appearance of input components (Dropdown, Input, TextArea). V0 input components default background color is grey-ish, whereas in V9 the background color is white.
Partners could change the background color to match the previous version of Fluent by passing a prop appearance with value filled-darker, but this solution does not scale well for partners when migrating to the new version and is error prone.
This RFC explores potential solutions for partners, so they could migrate input components to V9 without the extra work of adding an additional prop to input components.
Partners should also easily revert the decision to the default appearance value if they decide so, without changing inputs individually.
๐ Cons of adding appearance to achieve the same design as V0:
Another option is to use React Context to override appearance defaults in FluentProvider.
function App() {
return (
<FluentProvider appearance="filled-darker">
<Input />
<Input appearance="underline" />
</FluentProvider>
)
}
๐ more universal solution than a custom token - can be used to override different concepts, not only tokens - props, icons, etc.
๐ new concept
๐ one-off just for the Input background (although it would be used in multiple input components)
Partners could create a new composed component on application side. and modify the props in their preferred way. If the partner would like to keep the original color, they could create the composed component and have the default component without the appearance prop renders as filled-darker.
export const Input: ForwardRefComponent<InputProps> = React.forwardRef((props, ref) => {
const state = useInput_unstable({ appearance: 'filled-darker', ...props }, ref);
useInputStyles_unstable(state);
return renderInput_unstable(state);
});
๐ Pros:
๐ Cons:
Dropdown, Input, TextArea and DatePickerPartners could a new component wrapper that will wrap input components and modify the appearance prop on the application side.
export const Input: ForwardRefComponent<InputProps> = React.forwardRef((props, ref) => {
return <BaseInput appearance="filled-darker" {...props} ref={ref} />;
});
๐ Pros:
๐ Cons:
Dropdown, Input, TextArea and DatePickerTargeting all input selectors from a partner app and change the color with global css.
Example: https://codesandbox.io/s/rfc-inputs-ew821q?file=/app.tsx
๐ Pros:
FluentProvider)๐ Cons:
Adding a new alias color token (let's say colorInputBackground) and use it for all inputs.
๐ Pros:
๐ Cons:
Another option is to add a possibility to override the background using a CSS variable:
We can use backgroundColor: var(--inputBackgroundOverride, ${tokens.colorNeutralBackground1}) without setting the --inputBackgroundOverride anywhere. Then an application can set that variable if it needs to override the background.
๐ no additional tokens unless needed
๐ new concept ๐ one-off just for the Input background (although it would be used in multiple input components)
Discuss with designers to unify V0 and V9 design, setting the appearance to filled-dark by default.
๐ Props:
๐ Cons: