-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Mantine UI Series] Stepper #20
Comments
The Mantine UI Stepper componentMantine UI Stepper component's API design has considered nearly all the usage scenarios mentioned earlier. Good React practices for Developers
type StepperComponent = ForwardRefWithStaticComponents<
StepperProps,
{
Step: typeof Step;
Completed: typeof StepCompleted;
}
>;
Stepper.Step = Step;
Stepper.Completed = StepCompleted;
Stepper.displayName = '@mantine/core/Stepper'; export type ForwardRefWithStaticComponents<
Props extends Record<string, any>,
Static extends Record<string, any>
> = ((props: Props) => React.ReactElement) &
Static & {
displayName: string;
};
Utilizing the composition pattern enhances developer flexibility in structuring code, but poses challenges in enforcing expected usage. To avoid unexpected content rendered inside of the Stepper, Mantine handles the concern in the following way const _children = convertedChildren.filter((child) => child.type === Step);
const completedStep = convertedChildren.find((item) => item.type === StepCompleted);
acc.push( cloneElement(item, {/**some other code**/}));
import React from 'react';
const Title = () => <h1>Hello, Title!</h1>;
const App = () => {
const htmlChild = <div>This is a div.</div>;
const componentChild = <Title />;
console.log('HTML child type:', htmlChild.type); // Outputs: "div"
console.log('Component child type:', componentChild.type); // Outputs: Reference to the Title component
};
export default App;
|
The Design Flaw of the Stepper ComponentLack of Consideration for Horizontal ModeThere are situations where you'd like to control the layout between Step content and the Stepper progress bar. Although the Stepper component provides two orientation modes: vertical and horizontal, the horizontal mode does not necessarily mean that the Mantine Stepper aligns its Step content on the right side, as shown bellow: Given the source code of the Stepper, the solutions for achieving the desired UI layout are as follows:
Mental block on understanding allowStepClick and allowStepSelect LogicThe logical design of |
Overview
This article talks about Mantine UI Stepper component, including:
When and How Stepper Components Are Used
When user are in a complex flow of doing something, such as
In Front end Development domain and real world use cases:
The text was updated successfully, but these errors were encountered: