-
Notifications
You must be signed in to change notification settings - Fork 4.5k
DropZone: Allow overriding the default icon #70236
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
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! As with labels, I think it makes sense to allow the default icon to be overridden.
/** | ||
* An icon to be shown within the drop zone area. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* An icon to be shown within the drop zone area. | |
*/ | |
/** | |
* An icon to be shown within the drop zone area. | |
* | |
* @default "upload" | |
*/ |
I'm not sure if this is the right way to express a JSX element as a default value, but I followed the format of the DropdownMenu
component:
gutenberg/packages/components/src/dropdown-menu/types.ts
Lines 65 to 71 in f1ebacf
export type DropdownMenuProps = { | |
/** | |
* The icon to be shown in the collapsed menu button. | |
* | |
* @default "menu" | |
*/ | |
icon?: IconProps[ 'icon' ] | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I was checking other examples, but didn't see this one.
P.S. It seems that icon
prop types are defined in different ways. I initially tried using IconProps
, but I was getting a type error. It might be a good idea to standardize this in the future.
cc @WordPress/gutenberg-components
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
What?
Closes #14335.
PR introduces a new
icon
prop for theDropZone
component and allows overriding the default upload icon.This is a slightly different approach from the one proposed in the issue, but it allows content modification without consumers needing to worry about custom CSS.
Testing Instructions
npm run storybook:dev
icon
prop forDropZone
component.Testing Instructions for Keyboard
Same.
Screenshots or screencast
CleanShot.2025-05-28.at.13.49.47.mp4