You can use your code like in below example:

<div className={`w-0 h-0 border-8 border-solid border-transparent mx-auto border-${isCardExpired ? '[rgb(250,77,86)]' : '[rgb(232,125,26)]' }`} ></div>

However what you are trying to achieve is difficult through tailwind CSS, as Tailwind CSS is primarily designed for utility-first and atomic CSS classes. Complex border styling like the one you described might not be achievable with Tailwind classes alone. You will have to use like below

function App() {
  const isCardExpired = true;
  const borderColor = isCardExpired ? 'border-red-600' : 'border-orange-500';

  return (
    <div className="flex justify-center">
      <div className={`w-0 h-0 ${borderColor} border-b-8`} style={{ borderLeft: '9px solid transparent', borderRight: '9px solid transparent' }}></div>
    </div>
  );
}

export default App;
Answer from Mehnaz Yasmeen on Stack Overflow
๐ŸŒ
Kombai
kombai.com โ€บ tailwind โ€บ border-style
Tailwind CSS Border Style
Border style determines the style of the border- solid, dashed, dotted, double, hidden, or none. Tailwind CSS further simplifies adding the border styles through its suite of border style utilities.
๐ŸŒ
Tailwind CSS
tailwindcss.com โ€บ docs โ€บ border-width
border-width - Borders - Tailwind CSS
Use border or border-<number> utilities like border-2 and border-4 to set the border width for all sides of an element:
๐ŸŒ
Pagedone
pagedone.io โ€บ docs โ€บ borders
Tailwind CSS Borders | Pagedone
Border Style classes are used to style borders in tailwind css border.
Top answer
1 of 2
1

You can use your code like in below example:

<div className={`w-0 h-0 border-8 border-solid border-transparent mx-auto border-${isCardExpired ? '[rgb(250,77,86)]' : '[rgb(232,125,26)]' }`} ></div>

However what you are trying to achieve is difficult through tailwind CSS, as Tailwind CSS is primarily designed for utility-first and atomic CSS classes. Complex border styling like the one you described might not be achievable with Tailwind classes alone. You will have to use like below

function App() {
  const isCardExpired = true;
  const borderColor = isCardExpired ? 'border-red-600' : 'border-orange-500';

  return (
    <div className="flex justify-center">
      <div className={`w-0 h-0 ${borderColor} border-b-8`} style={{ borderLeft: '9px solid transparent', borderRight: '9px solid transparent' }}></div>
    </div>
  );
}

export default App;
2 of 2
0

You can use a utility like tailwind-merge or clsx like this:

<div 
  className={
    clsx("w-0 h-0 border-x-8 border-solid border-transparent mx-auto", 
    isCardExpired 
      ? "border-[rgb(250,77,86)]" 
      : "border-[rgb(232,125,26)]")} 
/>

You can also add the rgb colors to your theme for easier use:

module.exports = {
  theme: {
    extend: { ... },
    colors:{
      custom1: 'rgb(12,159,100)',
      custom2: 'rgb(232,125,26)'
      ...
    }
  },
  plugins: [...],
}

And then use it as:

<div 
  className={
    clsx("w-0 h-0 border-x-8 border-solid border-transparent mx-auto", 
    isCardExpired 
      ? "border-custom1" 
      : "border-custom2")} 
/>

Edit: explanation of Tailwind border dimensions are here. You already have border-x-8 border-solid which is not part of the conditional, so it will work as you posted. If you need the width and height to be 8px, then you can change the border-x-8 to border-8. If as you stated only bottom then border-b-8 instead of border-x-8.

๐ŸŒ
TW Elements
tw-elements.com โ€บ docs โ€บ standard โ€บ extended โ€บ borders
Tailwind CSS Borders - Free Examples & Tutorial
Use responsive borders utilities with TW elements. A tutorial how to style the border and border-radius of an element.
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ css โ€บ tailwind-css-border-style
Tailwind CSS Border Style - GeeksforGeeks
July 23, 2025 - This class is used for controlling the style of an element's borders. ... <!DOCTYPE html> <html> <head> <link href= "https://unpkg.com/[email protected]/dist/tailwind.min.css" rel="stylesheet"> </head> <body class="text-center"> <h1 ...
๐ŸŒ
GitHub
github.com โ€บ Log1x โ€บ tailwindcss-border-styles
GitHub - Log1x/tailwindcss-border-styles: Tailwind CSS plugin to generate individual border side style classes.
// tailwind.config.js { theme: { borderStyles: { styles: true, // defaults to false colors: true, // defaults to false } } plugins: [ require('tailwindcss-border-styles')(), ], }
Author ย  Log1x
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ tailwind_css โ€บ tailwind_css_border_style.htm
Tailwind CSS - Border Style
Tailwind CSS Border Style is predefined classes that allow you to easily set different styles for borders on elements, including their width, style (such as solid, dashed, or dotted), and radius.
๐ŸŒ
Geekster
geekster.in โ€บ home โ€บ border property in tailwind
Border Property In Tailwind - Geekster Article
July 2, 2024 - Master border property in tailwind CSS. Learn to style borders with ease using width, color, style, and radius utilities.
๐ŸŒ
Nativewind
nativewind.dev โ€บ docs โ€บ tailwind โ€บ borders โ€บ border-style
Border Style
October 14, 2025 - Border Style ยท Last updated on October 14, 2025 ยท Edit ยท Please refer to the documentation on the Tailwind CSS website ยท Use border-0 instead of border-none to remove borders on native.
๐ŸŒ
Tailwind CSS
tailwindcss.com โ€บ docs โ€บ outline-style
outline-style - Borders - Tailwind CSS
<input class="focus:border-indigo-600 focus:outline-hidden ..." type="text" />
๐ŸŒ
Tailwind CSS
v3.tailwindcss.com โ€บ docs โ€บ border-width
Border Width - Tailwind CSS
Preflight applies a global border ... just a border-width utility in projects using Preflight. Tailwind lets you conditionally apply utility classes in different states ......
๐ŸŒ
Tailwind CSS
tailwindcss.com โ€บ docs โ€บ border-radius
border-radius - Borders - Tailwind CSS
Here are all the available border radius logical property utilities and their physical property equivalents in both LTR and RTL modes. For more control, you can also use the LTR and RTL modifiers to conditionally apply specific styles depending on the current text direction.
๐ŸŒ
Tailwind
windframe.dev โ€บ tailwind โ€บ classes โ€บ tailwind-border-style
The tailwind border style utility .
April 2, 2024 - In Tailwind CSS, the border-style property is used to define the style of the border around an element.
๐ŸŒ
Tailwind CSS
tailwindcss.com โ€บ docs โ€บ box-sizing
box-sizing - Layout - Tailwind CSS
Use the box-border utility to set an element's box-sizing to border-box, telling the browser to include the element's borders and padding when you give it a height or width.