how to position MUI tooltip dynamically inside a container dynamically so that when the element is near the edge of the container it does not overflow - material-ui

enter image description here
For example—
in this image when i hover on the button (click) on the left side, the tooltip is going out of the red bordered container.
same thing happens for the right side button.
i want to change the tooltip position dynamically so that it stays inside the container for both the cases.
p.s - new to stackoverflow. If anything is wrong please pardon.
thanks in advance.
<Tooltip
title=“aaa”
arrow
placement=“bottom”
>
<button> click </button>
</Tooltip>
this is code for the MUI tooltip.i tried to look for props that can help me with this but failed.

You can do this by accessing the PopperProps in the Tooltip component.
The documentation for this is a little buried, but Tooltip has access to all MUI Popper component properties, which contain the popperOptions. Within the API properties definitions for the Popper component, MUI refers you to popper.js docs. These docs will then tell you how you can apply PopperProps to get different behaviors. Check out popper.js.org for further info.
const boundingElement = useRef();
[...]
<div
ref={boundingElement}
>
<Tooltip
title="Tooltip Tooltip Tooltip Tooltip Tooltip"
PopperProps={{
popperOptions: {
modifiers: [
{
name: "preventOverflow",
options: {
boundary: boundingElement.current
}
}
]
}
}}
>
<div>Tooltip Hover Div</div>
</Tooltip>
</div>

Related

React MUI focusVisible ripple animation on hover

I rather like the focus animation on buttons (e.g., when tabbing through them). I'd like to apply the same animation on hover as well.
It looks like this, but pulsating:
It looks like it adds a prefix-focusVisible class when focused, and it makes some modifications to an internal <span> in the button. It looks like ButtonBase has a ripple ref that it calls pulsate() on, which I think is what activates it.
Is there a clean way I can invoke this on hover for Buttons?
One of the Button props is touchRippleRef, which exposes a pulsate() function. I wrapped the Button component, and got the pulsing-ripple-animation on hover working:
function LinkButton(props: ButtonProps) {
const touchRippleRef = useRef<TouchRippleActions>(null)
return <Button
{...props}
touchRippleRef={touchRippleRef}
onMouseEnter={() => touchRippleRef.current?.pulsate()}
onMouseLeave={() => touchRippleRef.current?.stop()}
/>
}
Works like a charm.

Align navigation item with dropdown having icon in BootstrapVue

When I place an icon into b-nav-item-dropdown the vertical alignment of navigation bar gets broken:
<b-navbar-nav class="ml-auto">
<b-nav-item :to="{ name: 'sign-in'}">Sign in</b-nav-item>
<b-nav-item-dropdown toggle-class="text-warning" right>
<template v-slot:button-content>
<b-icon-info font-scale="2"></b-icon-info>
</template>
<b-dropdown-item :to="{ name: 'help'}">Help</b-dropdown-item>
</b-nav-item-dropdown>
How can I align them? Is there BootstrapVue native way? The nav components miss align-v attribute.
Instead of using font-scale (which increases the font size of the icon), use the scale prop, which uses a CSS transform to increase the icon size without changing the font size (as mentioned by #Hiws on Discord channel).
<template v-slot:button-content>
<b-icon-info scale="2"></b-icon-info>
</template>

Clickable Sub Header in ionic v1

I have hader in ion-view like
ion-view(title='{{review_type}} reviews',ng-cache="false",cache-view='false')
wta-nav-action-right(icon='icon-white-plus', action='reviewAdd')
ion-content
review-empty-list(ng-show='!reviews.length')
section(style="margin-top:10px")
wta-review(ng-repeat='review in reviews')
infinite-scroll(items='reviews', query='query')
I converted this to two line header like this
I am trying to convert “Blueberry Wine” into hyperlink so that by clicking on this user can navigate to respective Page…
I tried but ng-click event is not triggered.
I put span tag inside the ion-view title and give ng-click attribute to that span but still event is not triggered.
ion-view(title='<span class="header",ng-click="clickable()">{{review_type}} reviews</span>,'ng-cache="false",cache-view='false')
I done this by adding this .. here is code pan link https://codepen.io/calendee/pen/bLJcD
ion-view(title='{{review_type}} reviews',ng-cache="false",cache-view='false')
wta-nav-action-right(icon='icon-white-plus', action='reviewAdd')
ion-content
section
nav
a.col.text-center.center(style="background-color: #f0483d;color: white;padding: 10px 0")
h4(style="color :white") Winery Name
review-empty-list(ng-show='!reviews.length')
section(style="margin-top:10px")
wta-review(ng-repeat='review in reviews')
infinite-scroll(items='reviews', query='query')

How to add button to Textview dynamically

I have a question here, i need to add some button to the TextView in my tree table header row, the color of Button should be changed according to the line items rows(child nodes) data.
How could that possible? please anyone help me on this.
<TextView id="idKuljkiel" semanticColor="Critical" text="{path:'zstrv_fun>KuljKiel', formatter:'.zchangeColor'}" />
I have created formatter function where i can write some code to create a button, but i am unable to add button to the TextView, and the color of the button should be changed as traffic lights.
For example if childrows have "X" or "" then Yellow,
if childrows have "X" or "X" then Green
if childrows have "" or "" then Red
Can anyone help me on this?
You cannot add a Button or any other control to a TextView. It does not support child controls.
In a formatter you should not modify the view. Its meant to just format a value. It should be idempotent.
The Button control does not support arbitrary colors. It has a style property that lets you change the button to red (reject), green (accept) or gray (default). colors depend on the theme.
Yout can put the TextView together with a Button into a HorizontalLayout. You can then bind the visible property of the Button to your model (and use a formatter if needed).
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.ui.commons" xmlns:l="sap.ui.layout">
...
<l:HorizontalLayout>
<TextView id="idKuljkiel" semanticColor="Critical" text="{path:'zstrv_fun>KuljKiel', formatter:'.zchangeColor'}" />
<Button visible="{path:'zstrv_fun>WhatEver', formatter:'.zbuttonVisible'}" style="{path:'zstrv_fun>Bla', formatter:'.zbuttonStyle'}"/>
</l:HorizontalLayout>
...
</mvc:View>
Dependig on your data structure inside your model it might be possible to bind to the whole row object and use that in the formatter. Otherwise it could be necessary to process the model data after load to calculate additional properties on the header rows.

Dojo / Dijit Accordion - Add Expand and Collapse Arrows

Trying to figure out how to add the expand / collapse arrow images on Dojo's Accordion dijit.layout.AccordionContainer just like the dijitTitlePane / dojox.widget.TitleGroup has.
Did a bit of research to find out where the TitlePane was getting the arrow images from and found it was a sprite image. I've created some extra code that uses that same sprite image to add the expand and collapse arrows to the AccordionPane. Have to add some extra CSS to the theme in order to make this work:
Add the following near line 2625 in /themes/THEME_NAME/THEME_NAME.css:
.THEME_NAME .dijitAccordionArrow {
background:url("images/spriteArrows.png") no-repeat -14px top;
width:7px;
height:8px;
margin-top:-1px;
}
.THEME_NAME .dijitAccordionTitleSelected .dijitAccordionArrow {
background:url("images/spriteArrows.png") no-repeat;
margin-top:-1px;
}
Replace THEME_NAME with whatever the name of your stock theme (i.e. claro) or the name of your custom theme.