New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: built-in responsive mode support #24289
Comments
@AkiraVoid usually such solutions have problems or consequences with SSR.
There is a good explainer (https://github.com/artsy/fresnel#why-not-conditionally-render) on why conditional rendering is not so great. The fair note is that with "double rendering" we don't have such issue. The simplest way to keep DOM same is to use |
@layershifter Could Fluent UI teams publish a spec of what responsible UI solutions you are currently using, and the breakpoints you defined? Although there may not be a standard method to achieve this feature, but at least we users of this design system, as products developers, want to make everywhere of our own UI consistent. |
You probably can also make them be design tokens in |
AFAIK currently we have breakpoints for
This makes sense. But probably it will be a separate object (may be
|
I've contacted designers regarding the possibility of adding breakpoints to tokens or at least having them somewhere globally at design specs, @paulgildea, do we have a follow up on that? |
As we look at adding more tokens we should consider how these tokens can be opt-in for products so we don't keep increasing the total number of required tokens. |
import { GriffelStyle } from '@fluentui/react-components';
type BreakpointFunction = (
styles: GriffelStyle
) => Record<string, GriffelStyle>;
interface IBreakpoints {
/**
* X-Small devices (portrait phones, less than 576px).
*
* @type {BreakpointFunction}
* @memberof IBreakpoints
*/
xs: BreakpointFunction;
/**
* Small devices (landscape phones, less than 768px).
*
* @type {BreakpointFunction}
* @memberof IBreakpoints
*/
s: BreakpointFunction;
/**
* Medium devices (tablets, less than 992px).
*
* @type {BreakpointFunction}
* @memberof IBreakpoints
*/
m: BreakpointFunction;
/**
* Large devices (desktops, less than 1200px).
*
* @type {BreakpointFunction}
* @memberof IBreakpoints
*/
l: BreakpointFunction;
/**
* X-Large devices (large desktops, less than 1400px).
*
* @type {BreakpointFunction}
* @memberof IBreakpoints
*/
xl: BreakpointFunction;
}
const breakpoints: IBreakpoints = {
xs: style => {
return { '@media (max-width: 575.98px)': style };
},
s: style => {
return { '@media (max-width: 767.98px)': style };
},
m: style => {
return { '@media (max-width: 991.98px)': style };
},
l: style => {
return { '@media (max-width: 1199.98px)': style };
},
xl: style => {
return { '@media (max-width: 1399.98px)': style };
},
};
export default breakpoints; Above is the approach I'm using, it performs well, may be helpful. It is capable with other Griffel features like |
Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes. Still require assistance? Please, create a new issue with up-to date details. |
Library
React Components / v9 (@fluentui/react-components)
Describe the feature that you would like added
In v8 we have
useResponsiveMode
to make building responsible page easier, but in v9 I didn't find something like this.Have you discussed this feature with our team
No. I opened a discussion on GitHub but no one answered me.
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: