Skip to content

[EuiBasicTable] add nameTooltip API  #7963

Closed

Description

@alexwizp

This feature request is based on this comment and suggests adding a new nameTooltip API for EuiBasicTable.

Example:

const columns = [
  {
    field: 'github',
    name: 'Github',
    nameTooltip: {
      content: 'Their mascot is Octokitty',
      icon: 'questionInCircle', // default icon, but can be customized
      iconProps: { color: 'subdued' }, // allows customizing the icon color/size etc if needed
      tooltipProps: { position: 'bottom' }, // allows additional tooltip configuration
    },
    render: (username: User['github']) => (
      <EuiLink href="#" target="_blank">
        {username}
      </EuiLink>
    ),
  },
];

Activity

  1. added
    low hanging fruit
    on Aug 19, 2024
  2. removed their assignment
    on Dec 13, 2024
  3. self-assigned this
    on Jan 10, 2025
  4. acstll commented on Jan 14, 2025

    @acstll
    Contributor

    I started implementing this in #8273 and I have a question regarding the actual API. (I went and read thru all previous discussion I could find).

    I understand the proposed API is flexible enough while keeping things under control. And I believe it's also decoupled from the implementation. If we use EuiIconTip, the props are mapped like this:

    nameTooltip: {
        content: 'Their mascot is Octokitty', // passed to EuiIconTip's `content` [same]
        icon: 'questionInCircle', // passed to EuiIconTip's `type`
        iconProps: { color: 'subdued' }, // passed to EuiIconTip's `iconProps` [same]
        tooltipProps: { position: 'bottom' }, // spreaad to EuiIconTip's subset of the EuiToolTip props
    },

    I think this is good. But I'm also thinking whether things would be simpler if the shape of nameTooltip would match exactly the props from EuiIconTip.

    The implementation would be simpler, there would be no need for a new shape/type, but it would be somehow bound to EuiIconTip.

    Is this a silly idea? What do you think?

  5. cee-chen commented on Jan 22, 2025

    @cee-chen
    Contributor

    Definitely not a silly idea, but (unfortunately) it's a bit of a question of consistency rather than optimal naming at this point. tooltipProps is a fairly commonly used API across multiple components in EUI at this point, so it's one that's more familiar for devs to reach for (as opposed to having an entire object be the props for a dogfooded component, which isn't a pattern we've used previously in EUI).

    Additionally, my 2c is I think a custom object structure is more flexible in terms of typing than doing something like nameTooltip?: EuiIconTipProps;. It allows us to set default props for props that may otherwise be required by the underlying component. That's not necessarily a dealbreaker, just a typing hassle, so I think the consistency argument above is a slightly stronger one.

  6. acstll commented on Jan 23, 2025

    @acstll
    Contributor

    it's a bit of a question of consistency rather than optimal naming at this point

    this is the answer I was looking for — there's really no point in introducing a new API just for the sake of a simpler implementation, I will refactor back…

    @cee-chen thanks for chiming in 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

accessibilitylow hanging fruit

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions