Description
Currently, toast notifications allow passing a custom icon, but do not provide a public API to control the icon position inside the toast layout
This is limiting in cases where the icon should be:
top-aligned for multi-line content
- placed on the
right and vertically centered
- placed on the
right and top-aligned
At the moment, this can only be done with custom className and CSS overrides, which makes the solution dependent on internal layout styles
Proposed API
Add an iconPosition option to toast API, for example:
start-center
start-top
end-center
end-top
Example:
toast.show({
title: "Saved",
children: "Changes have been published",
icon: <Icon svg={Check} size={5} color="positive" />,
iconPosition: "end-top",
});
Reproduction
I created a reproduction case showing that while toast supports a custom icon, its position can't be configured through public API and currently requires CSS overrides
CodeSandbox: https://codesandbox.io/p/devbox/reshaped-toast-icon-position-3-9-0-jvc9lh
Description
Currently, toast notifications allow passing a custom
icon, but do not provide a public API to control the icon position inside the toast layoutThis is limiting in cases where the icon should be:
top-alignedformulti-linecontentrightandvertically centeredrightandtop-alignedAt the moment, this can only be done with custom
classNameand CSS overrides, which makes the solution dependent on internal layout stylesProposed API
Add an
iconPositionoption to toast API, for example:start-centerstart-topend-centerend-topExample:
Reproduction
I created a reproduction case showing that while toast supports a custom
icon, its position can't be configured through public API and currently requires CSS overridesCodeSandbox: https://codesandbox.io/p/devbox/reshaped-toast-icon-position-3-9-0-jvc9lh