How to add focus state to components / Figma

Поділитися
Вставка
  • Опубліковано 26 гру 2024

КОМЕНТАРІ • 18

  • @svetvn
    @svetvn 3 місяці тому

    Thank you, Masha! I think this is a great approach! I appreciate your time and sharing this with us!

    • @mash312
      @mash312  3 місяці тому

      thank you so much! :)

  • @robertovenditti1515
    @robertovenditti1515 Рік тому +1

    Super clever! Thank you. I just added a stroke manually, but this is much better :)

    • @mash312
      @mash312  Рік тому

      sweet! And yes, I used to manage focus states with strokes but it got so tedious quickly

  • @benlow24
    @benlow24 5 місяців тому

    Thanks for showing the trick about layer ordering for absolute position. Was going nuts with a text input I’ve made and this solved it.

    • @mash312
      @mash312  5 місяців тому

      amazing, happy this helped!

  • @mash312
    @mash312  Рік тому +2

    also! wanted to note that most component libraries probably don't need to have a focus state variant.
    but if you do, this is quite an efficient way to do it :)

    • @alexzlatkus7057
      @alexzlatkus7057 Рік тому +1

      If you did have it, would you also consider adding it as a boolean prop, so the focus-ring could be shown on any state? 🤔

    • @mash312
      @mash312  Рік тому

      @@alexzlatkus7057 as a separate variant, because it shouldn’t be shown on every state (focus is its own separate state)

  • @pearlite6243
    @pearlite6243 9 місяців тому

    Thank you so much!! This was really helpful!! I saw a design system that had a focus ring component nested within the button component, but when I tried recreating it myself, I was getting stuck with the button autolayout. This tutorial was exactly what I needed to figure it out

    • @mash312
      @mash312  8 місяців тому +1

      So happy it was useful, thank you :)

  • @liliya5930
    @liliya5930 9 місяців тому

    Thanks a lot for your very useful tutorial! I would greatly appreciate it if you could clarify the distinction between "secondary" and "subtle" in your naming. Are they not synonymous?

    • @mash312
      @mash312  8 місяців тому

      Thank you so much :) In this specific case, "subtle" could also be interpreted as "tertiary".
      You're absolutely right though -- in some design systems, the two can be equivalent.

  • @PierreLord
    @PierreLord Рік тому

    Clever way to manage focus offset.. Thanks for sharing. With variables now applicable to effects, I wonder whether you see a reason not to use an effect (that mimics a border) to create focus ring - aside from the offset thing..?

    • @mash312
      @mash312  Рік тому +1

      thank you! and i haven't looked at the variables for effects yet, that also looks like a convenient solution 🙏

  • @2x2_happy
    @2x2_happy Рік тому

    Very smart approach, thank masha for sharing, this is definitely the best practice for absolute positioning

    • @mash312
      @mash312  Рік тому +1

      thank you ☺️

  • @StritarD
    @StritarD 10 місяців тому

    Thanks!