question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat(elevation): Elevation to support negative values to show box-shadow up oriented

See original GitHub issue

Feature Description

Elevation helper only supports values between 0 and 24, and with those values the box shadow shows below.

I see the value of supporting negative values too (-24 to 24) where the negative values apply the same logic/style but above the component. Changing the box-shadow Y offset of the already provided values is working fine.

Use Case

Tabs component supports headerPosition whether is above|below (https://material.angular.io/components/tabs/api#MatTabHeaderPosition)

So If I want to build a top tab navigation menu and I want to have elevation working on top with the headerPosition="below" I can have a good looking component as here:

Captura de pantalla 2021-02-14 a las 19 58 00

The only problem is that elevation does not support the shadow on top but rather only on bottom.

Usage Proposal

For using the mat-elevation mix, it would be:

@import '~@angular/material/theming';

mat-tab-group {
  @include mat-elevation(-8);
}

For using the class selector, it would be:

<mat-tab-group class="mat-elevation-z-8">....</mat-tab-group>

The values for the negative elevations would be the same as for the positive but just adding a negative mark (-) for the Y offset, so no changes in terms of design/elevation/values are being suggested here.

I already know where to make the changes in the source code, but instead of pushing a PR, I thought it was worth to first suggest the change here and see if you agree or see the point of this feature.

Note: I can work-around this just using plain css, but I think the elevation helper is very clean and powerful and it would be great if it would support this use case too, imo.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
BH4NGcommented, Mar 7, 2021

mat-excavation-z would seem the most logical to me. +1 on the feature request

0reactions
angular-automatic-lock-bot[bot]commented, Apr 10, 2021

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

box-shadow - CSS: Cascading Style Sheets - MDN Web Docs
The box-shadow CSS property adds shadow effects around an element's frame. ... Negative values place the shadow to the left of the element....
Read more >
box-shadow - CSS-Tricks
The box-shadow property in CSS is for putting shadows on elements ... positive values increase the size of the shadow, negative values ......
Read more >
Applying box shadows in React Native - LogRocket Blog
Both width and height props can accept positive and negative values. The third prop is shadowOpacity , which sets the transparency of the...
Read more >
Elevation & shadows - Material Design
Desktop resting elevation is 2dp below the listed values to accommodate mouse and non-touch environments. Component elevations: Components maintain consistent ...
Read more >
Untitled
Sansho the bailiff trailer, Vw classic camper van new, Stand up break in, ... Cable data show, Chinese go kart steering parts, Deur...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found