Fix window
Basic Usage
The FixWindow component is designed to attach itself to a parent element and dynamically adjust its position. It uses
either fixed or absolute CSS positioning, depending on the configuration. The window will automatically reposition
itself to ensure it stays within the visible boundaries of the screen.
In this example, the FixWindow appears when you hover over the button.
Model value
The modelValue prop controls the visibility of the FixWindow. When true, the FixWindow is displayed; when false, it is hidden. This prop is useful for programmatically managing the visibility of the window.
Type position
The typePosition prop determines whether the FixWindow uses absolute or fixed CSS positioning.
absolute: Positions theFixWindowrelative to its nearest positioned ancestor.fixed: Positions theFixWindowrelative to the viewport.
Positioning
The position of the FixWindow can be controlled using the position prop. Available options include top, bottom,
left, right, and combinations like bottom-right.
The component will also dynamically adjust its position when the parent element moves closer to the edges of the visible
screen. This ensures the FixWindow remains fully visible without overflowing the viewport.
Trigger Events
The FixWindow can be configured to open and close based on specific user interactions. Here’s a breakdown of the
supported events:
Hover
Opens when the user hovers over the parent element and closes when the user's cursor leaves it.
Click
Opens when the user clicks on the parent element and closes on another click.
Double clicks
Opens when the user double-clicks on the parent element and closes on another double-click.
Mousedown
Opens when the user presses the mouse button and closes when the button is released.
Mouseup
Opens when the user releases the mouse button and closes when the user clicks elsewhere.
Context Menu
Opens when the user right-clicks on the parent element.
None
Prevents the FixWindow from opening automatically. Use this if you want to control the visibility programmatically or via a close button.
Element
The el prop specifies the target element that the FixWindow should align with. By default, the FixWindow will align itself with its parent element, but you can use this prop to explicitly set a target.
Scrollable Element
The scrollableEl prop defines the scrollable element that affects the position of the FixWindow. This ensures that the FixWindow dynamically adjusts its position when the scrollable element moves.
Delay
The delay prop introduces a delay (in milliseconds) before the FixWindow opens after the triggering event. This is useful for preventing accidental openings.
Margin Px
The marginPx prop sets the margin (in pixels) between the FixWindow and its parent element.
Translate Px
The translatePx prop fine-tunes the position of the FixWindow by translating it along the x or y axes (in pixels).
Padding Window
The paddingWindow prop adds padding around the FixWindow to prevent it from getting too close to the edges of the screen.
By Cursor
The byCursor prop positions the FixWindow relative to the cursor's location. This is particularly useful for context menus or tooltips that need to follow the user's actions.
Close Button
You can enable a close button inside the FixWindow by setting the closeButton prop to true. This is especially
useful when the eventClose prop is set to none, as it provides users with a way to close the window.
Styling
Mode
The mode prop allows you to control the general appearance of the FixWindow. Available options include:
- filled: Adds a background color and rounded corners.
- outlined: Adds a border with no background.
- underlined: Adds a subtle underline style.
Custom Class
You can apply custom styles to the FixWindow using the class prop. This allows you to override or add additional
styles to the container.
Body Class
For more granular control, you can style the content area inside the FixWindow using the classBody prop.
Prevent Event Propagation
The stopOpenPropagation prop stops the opening event (such as click, hover, etc.) from propagating to parent
elements. This is useful in cases where the FixWindow is inside a component that has its own event handlers.
For example, if a FixWindow is inside a Button that triggers another action on click, you can use
stopOpenPropagation to prevent the click event from propagating to the button's parent.
