Skip to content
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

Disable close button #838

Closed
novecento opened this issue Jan 24, 2025 · 1 comment
Closed

Disable close button #838

novecento opened this issue Jan 24, 2025 · 1 comment

Comments

@novecento
Copy link

Sorry to bother you, but is it possible to disable the Close button on DockView?

@subaanqasim
Copy link

You can disable the close button by extending the default tab component:

import { IDockviewPanelHeaderProps, DockviewDefaultTab } from 'dockview';

const MyCustomTab = (props: IDockviewPanelHeaderProps) => {
    const onContextMenu = (event: React.MouseEvent) => {
        event.preventDefault();
        alert('context menu');
    };
    return <DockviewDefaultTab onContextMenu={onContextMenu} hideClose={true} {...props} />;
};

You can then use the extended component to be the default rendered tab using the defaultTabRenderer prop, or provide it as part of a list of different tab components if you want to be able to select different tab components per panel/group.

Link from the docs: https://dockview.dev/docs/core/panels/tabs#extend-the-default-tab-implementation

@mathuo mathuo closed this as completed Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants