Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass down the EUI classname attribute #184

Open
jusa3 opened this issue Dec 13, 2024 · 2 comments
Open

Pass down the EUI classname attribute #184

jusa3 opened this issue Dec 13, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@jusa3
Copy link
Collaborator

jusa3 commented Dec 13, 2024

Each widget should provide styling options by passing down a classname property (see TitleWidget as an example).

@jusa3 jusa3 added the enhancement New feature or request label Dec 13, 2024
@Pooya-Oladazimi Pooya-Oladazimi self-assigned this Dec 19, 2024
@Pooya-Oladazimi
Copy link
Collaborator

As I looked the TitleWidget, I think we do not have to pass down the classname. we can assign the classname to the widget container and let user override it by using cascading in CSS with asterisk *

<div className={finalClassName}>
      {titleText &&
        <TitlePresentation
          titleText={titleText}
        />
      }

      {!titleText && isSuccess && data &&
        <TitlePresentation
          title={isOntology(data) ? data.getName() : data.getLabel()} />
      }

      {!titleText && isLoading && (defaultValue ? (
          <TitlePresentation titleText={defaultValue} />)
        : <EuiLoadingSpinner size="s" />)
      }

      {!titleText && isError && (defaultValue ?
        <TitlePresentation titleText={defaultValue} /> :
        <EuiText>{getErrorMessageToDisplay(error, "title")}</EuiText>)}
    </div>

and css:

.title-styles *{
  font-weight: bold;
}

@Pooya-Oladazimi
Copy link
Collaborator

The other issue with this approach (noticed in autocomplete) is that for complex component that comprises of many sub elements, we cannot customize all of them with one class for the parent component.
For example, in autocomplete, the className will affect which element? dropdown options? input box? terms tags?

Pooya-Oladazimi added a commit that referenced this issue Dec 19, 2024
add a new input prop for autocomplete widget that let users define a
wrapper class for it and customize the component CSS with using this
class.

related to #184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants