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

Dynamic inline-styles for buttons(tiles) #939

Open
1 task done
BrianWahinya opened this issue May 9, 2024 · 1 comment
Open
1 task done

Dynamic inline-styles for buttons(tiles) #939

BrianWahinya opened this issue May 9, 2024 · 1 comment
Labels
enhancement New feature or request stale

Comments

@BrianWahinya
Copy link

BrianWahinya commented May 9, 2024

Before you start - checklist

  • I have checked if this feature request is not already reported

Description

I would like to add dynamic inline-styling to a specific tile/button without assigning a className or changing tileContent.
In React it is possible to do this:

const userColor = getUserInput()
return <>
  <button>10<button>
  <button style={{ backgroundColor: userColor}}>11<button>
  <button>12<button>
</>

Assigning a tileClassName isn't sufficient because you need to already have defined the colors in an external CSS file for that particular class. This isn't dynamic.
My goal is to let the user decide the color of a particular tile from a color-palette within the program.

Proposed solution

Similar to how we assign a className using tileClassName, there can be a method such as tileStyle to handle inline styling.

  const tileStyle= ({ date }) => {
      if(compare(date, targetDate)){
        return {
          backgroundColor: "#000",
          fontSize: "15px"
        }
      }
  }

 return <ReactCalendar tileStyle={tileStyle} />

Alternatives

No response

Additional information

No response

@BrianWahinya BrianWahinya added the enhancement New feature or request label May 9, 2024
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.

@github-actions github-actions bot added the stale label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

1 participant