Forum Discussion
Teams configurable tab disable remove button
this is the link
https://docs.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/create-tab-pages/removal-page
import * as microsoftTeams from "@microsoft/teams-js";
import { initializeIcons } from "@fluentui/react";
import { Provider, Button, Segment, teamsTheme } from "@fluentui/react-northstar";
import React, { useEffect, useState } from 'react';
import { useTeams } from "msteams-react-base-component";
initializeIcons();
const Remove = () => {
const [{ context }] = useTeams({});
const[remove,setRemove]=useState(false);
useEffect(() => {
if (context) {
if(context.frameContext==="remove"){
setRemove(true);
microsoftTeams.settings.setValidityState(false);
microsoftTeams.settings.registerOnRemoveHandler((removeEvent) => {
microsoftTeams.settings.getSettings((settings) => {
settings.contentUrl = "https://localhost:8080/#/channel"
});
removeEvent.notifySuccess();
});
}
}
}, [context]);
return (
<Provider theme={teamsTheme}>
{remove && <>
<Segment content={
<>
<h3>Are You Sure, You Want To Remove The Tab</h3>
<h3>Click on Continue to Remove</h3>
<Button content="Continue" style={{ marginTop:"5%" ,marginLeft: "360px" }} primary onClick={()=>{microsoftTeams.settings.setValidityState(true)}}/>
</>}/>
</>}
</Provider>
)
}
export default Remove;
the Remove button gets enabled after few seconds. even when i dont click on the button
Umag98 - In the documentation it is mentioned that Teams enables the Remove button after five seconds.
Thanks,
----------------------------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
- Umag98Oct 28, 2021Brass Contributor
Meghana-MSFT , it mentions if we wont set setValidity. but i have set it to false
but here it is mentioned that it can indicate the save is enabled or disabled.- Umag98Oct 31, 2021Brass Contributor
@Meghana-MSFT- Can't we handle the remove button similar to save button?
- Meghana-MSFTNov 02, 2021MicrosoftWe are setting up this sample. We will update you.