Skip to content

Add shadow-xs, increase alpha of shadow-sm to 0.05 #1333

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

Merged
merged 1 commit into from
Jan 24, 2020
Merged

Conversation

adamwathan
Copy link
Member

This PR adds a new shadow-xs utility that adds a very subtle 1px solid shadow with no vertical offset. It can be very useful when applying another shadow to an element that has the same background color as the canvas beneath it and you feel like you need a border to add extra separation, but a border is sort of the wrong solution because it's a solid color and really you just want to increase the distinction between two elements by sharpening the shadow.

Here's an example of where it's useful...

No border/distinction shadow:

image

Border, notice how weird it looks at the edge that crosses into the dark background:
image

Using shadow-xs to add a tiny bit of distinction without introduce a true solid border:
image

Since shadows aren't easily composable in CSS, the code I've used for that example involves two nested divs, each with their own shadow so they stack:

<div class="rounded-md shadow-lg ...">
  <div class="rounded-md shadow-xs ...">
    <!-- Card contents -->
  </div>
</div>

The reason I don't think it makes sense to just add this little 1px distinction border directly to shadow-lg and other large shadows is that it's not necessary when the card has a different color from the background already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants