-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add iconSize
to Breadcrumb props
#4624
Comments
iconSize
props to Breadcrumb propsiconSize
to Breadcrumb props
Can you share a bit more context about why you need a custom icon size? What kinds of other UI elements is this breadcrumb list placed next to? Are you applying other custom styles? |
Hi @adidahiya I just needed to be able to pass down the for example i currently have this: the first segment(s) parts of the breadcrumbs path icons are smaller than the last icon, as i can control the last icons size via the here is my breadcrumbs component code:
My
The code change is about then enabling me to define all icon sizes in the array of breadcrumbs paths like this:
|
Hi @joegasewicz, You can also provide a If you don't provide a For example: import {
Breadcrumb,
Breadcrumbs,
IBreadcrumbProps,
IBreadcrumbsProps,
Icon,
} from "@blueprintjs/core";
import React from "react";
const Example = () => {
// Assuming you want all the breadcrumbs to use the same icon size.
const BREADCRUMB_ICON_SIZE = 30;
const items: IBreadcrumbProps[] = [
{ href: "/user", icon: "user", text: "Saruman" },
{
href: "/user/projects",
icon: "list-detail-view",
text: "Projects",
},
];
const breadcrumbRenderer: IBreadcrumbsProps["breadcrumbRenderer"] = ({
icon,
...restProps
}: IBreadcrumbProps) => {
return (
<Breadcrumb
icon={
<Icon
icon={icon}
iconSize={BREADCRUMB_ICON_SIZE}
intent={restProps.intent}
/>
}
{...restProps}
/>
);
};
return <Breadcrumbs breadcrumbRenderer={breadcrumbRenderer} items={items} />;
};
export default Example; |
@saruman1234's suggestion looks like the right way to go. In addition, I don't think it makes sense to change the icon size without changing text size and spacing as well. If we do end up adding to the Blueprint API to support this use case, I would rather add an API which makes a more holistic size change to the breadcrumbs layout rather than just an icon size change (e.g. |
thanks @saruman1234 |
Environment
^3.33.0
Feature request
I want to be able to define an icon size in the breadcrumbs props. Currently I can only control the size of icon props
passed in via the
currentBreadcrumbRenderer
prop -But the above only changes the last icon component in the breadcrumb path.
Examples
The text was updated successfully, but these errors were encountered: