Borders meet at a diagonal.
Give an element width: 0 and height: 0 and then thick borders. With no content box, the four borders meet in the middle, and each one is drawn as a triangle because neighboring borders are cut at a diagonal where they join. Color one border and make its neighbors transparent, and a single triangle remains.
For a triangle pointing up that is 100px wide and 80px tall, set border-bottom: 80px solid #6366f1; and border-left and border-right to 50px solid transparent. The colored border sits opposite the point, its width sets the height, and the two transparent borders each set half the base. Corner triangles need only two borders, such as border-top in color and border-right transparent for a right angle in the top left.
The trick is old, and that is its strength. It works in every browser that has ever supported CSS borders, it needs no special property, and the triangle takes on the border color, so a theme switch or a hover state can recolor it with one declaration. Its limits come from the same place: the shape is made of borders, so it cannot hold a gradient or an image, and its box has no real width or height for layout. For a small arrow or caret those limits rarely matter.