Why ring instead of border? #14602
-
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Ring works by creating a box shadow around the element with a cutoff point. Shadows are not in the documents flow, but borders are. This means that adding a border affects the layout, but adding a ring does not. Outline is also out of the flow, but is often used for focus states. Using ring instead for most things leaves that property open to be assigned by focus. |
Beta Was this translation helpful? Give feedback.
-
@pspeter3 We still use borders a ton, what I meant by that comment is that when we do use |
Beta Was this translation helpful? Give feedback.
@pspeter3 We still use borders a ton, what I meant by that comment is that when we do use
ring-*
it's usually as an alternative to border, rather than as a focus ring. We useoutline-*
for focus rings most of the time now. So instead of thering
utility being optimized for focus rings by default (which is where the 3px width came from), we're optimizing for using it as a stroke/border by default, and making it 1px so it's more consistent with the border and outline utilities. Using 3px felt like a weird magic number, 1px as a default just feels less surprising I think.