Hi, I'm embedding <gd-dashboard> web compone...
# gooddata-ui
v
Hi, I'm embedding <gd-dashboard> web component into Angular app. Can I hide "Share" button? I have added listener for 'GDC.DASH/EVT.INITIALIZED' event and I'm seeing hideShareButton: false in event.detail.config. Is there a clean way to set it to true before initialization as we do to set dashboardId, workspaceId, locale?
k
Based on the available knowledge sources, there is currently no documented attribute or property for the
<gd-dashboard>
web component that allows you to directly hide the "Share" button (such as a
hideShareButton
attribute) in the same way you set
dashboard
,
workspace
, or
locale
before initialization. The supported attributes for
<gd-dashboard>
are
dashboard
,
workspace
,
locale
, and
readonly
. The
readonly
attribute will disable all user interactions that alter backend state, but it does not specifically mention hiding the "Share" button alone. There is no mention in the documentation of a way to set
hideShareButton
via an attribute or property before initialization for the web component approach [Dashboard custom element docs](https://www.gooddata.com/docs/gooddata-ui/latest/learn/web_components/dashboard_custom_element/). For iframe embedding, you can use the
hideControl=[shareButton]
URL parameter to hide the Share button [Embed Dashboards Using Iframes](https://www.gooddata.com/docs/cloud/embed-visualizations/iframes/embed-dashboard-via-iframe/), but this does not apply to the web component. In summary: There is no clean, documented way to set
hideShareButton
to true before initialization for the
<gd-dashboard>
web component in Angular.
You may need to rely on user permissions (e.g.,
Dashboard.VIEW
) to hide editing/sharing features, or consider using iframe embedding if you need fine-grained control over UI elements [Community Slack discussion](https://gooddataconnect.slack.com/archives/C01UR5BGAHY/p1705395811871239?thread_ts=1705395811.871239&amp;cid=C01UR5BGAHY). If you need more granular control, you may need to wait for future updates or consider a custom solution.
y
Hi Victor, thank you for your patience. It is possible to hide the Share button in embedded dashboards. You can achieve this by using the
hideShareButton
property in the
<Dashboard />
component configuration. For example:
Copy code
<Dashboard
  dashboard={idRef("yourDashboardId")}
  config={{
    hideShareButton: true,
  }}
/>
When this property is set to
true
, the Share button will no longer be displayed in the embedded dashboard. Please give this a try and let us know if it works as expected or if you need any further assistance.
👍 1
v
Hi @Yvonne Changamuka, thank you for response! You have provided the React solution. I honestly figured out that adding readonly attribure to the gd-dashboard web component hides Share button.
y
Hi Victor, thank you for pointing that out! Yes, adding the
readonly
attribute to the
gd-dashboard
web component does hide the Share button.I’m glad you found a solution that works for your case. Please let us know if you need any further assistance, we'll be happy to help.
🙌 1