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

[Datetimepicker] Easy way to customize action-buttons / pass color="accent" to OK button #388

Open
angelaki opened this issue Dec 30, 2024 · 1 comment
Labels
area: datetimepicker Issues about datetimepicker help wanted Extra attention is needed

Comments

@angelaki
Copy link

The title already says it all: I'm looking for a convenient way to pass the default OK-button a color="accent" attribute. Any idea how to achieve this?

@nzbin nzbin added help wanted Extra attention is needed area: datetimepicker Issues about datetimepicker labels Dec 31, 2024
@bah99
Copy link

bah99 commented Jan 5, 2025

Material 19 provides a convenient way to style or override components. Or you can utilize the generated token variables to customize styles (such as the .danger class). Below is an example:

// In your global style file

/* You can add global styles to this file and also import other style files */
@use "@angular/material" as mat;

html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: Roboto, "Helvetica Neue", sans-serif;
}

// Define custom themes
.accent {
  @include mat.theme(
    (
      color: mat.$magenta-palette,
    )
  );
}

.warn {
  @include mat.theme(
    (
      color: mat.$orange-palette,
    )
  );
}

.success {
  @include mat.theme(
    (
      color: mat.$green-palette,
    )
  );
}

// Alternatively, use the token variables
.danger {
  --mdc-text-button-label-text-color: red;
  // Add more custom styles here
}

Instead of using color="accent", you can apply the defined classes directly, like class="success", to the button.

Here's how it would look in practice:
Example Button Styling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: datetimepicker Issues about datetimepicker help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants