Skip to content

Conflict Between Custom Button Styles and Radix-UI in Next.js Project #162

Closed
@totorofly

Description

@totorofly

Hello,

I'm working on a project using Next.js (React-based) and I've encountered a styling issue with buttons that I need some assistance with.

Issue Description:
When I set the following CSS properties for buttons:

@import "@radix-ui/themes/styles.css"; 

/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Remove default button styles.
*/

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button; /* 1 */
  background-color: transparent; /* 2 */
  background-image: none; /* 2 */
}

I notice that buttons styled with xxx become invisible - nothing is displayed.
图片

However, if I remove the background-color: transparent; line, the button's appearance returns to normal.
图片

Additional Context:
The need to ensure the button's base style is reset is critical for my project, hence setting background-color: transparent; is essential.
This seems to be a conflict with Radix-UI styles.

Question:
How can I resolve this conflict while maintaining the necessary style reset for my buttons? Is there a workaround or a better practice to achieve the desired outcome without compromising the visibility of the buttons?

Any insights or suggestions would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existsecosystemIncompatibility with something elsetailwindAn issue related to Tailwind

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions