How to change the property default message "No Value"

Hi!

A simple question: I have my properties on the right sidebar, and because I want to minimize the space used, I want to change the property default message “No Value” (when nothing is input) to something shorter (like 0). Any way to do it via CSS? I know I could simply put 0 for each property in my templates but that would mess up other things so it needs to be the default message.

Many thanks for any inputs!!

So I can’t test this, because I don’t see “No Value” in my properties, so I don’t have the context to see what you mean. Mine say “Empty”, and in the sidebar, just a count. And the snippet below doesn’t work for me, if I change it to “Empty”.

But here ariehen shared a bunch of properties CSS snippets, including one that hides ones with that placeholder value. Check out the whole thread for more ideas. Properties view CSS - The Fall Collection

.metadata-property:has([placeholder="No value"]) {
    display: none;
}

Alternatively, you could use a short word like “null” or “nil”, rather than 0.

1 Like

Thanks for your quick reply!

So I’m using it in French, hence I wasn’t sure about the english translation, but yeah it should be “Empty” on your side! (for me Aucune valeur)
I tried both in English and French, but to no avail.
I think Ariehen’s code is to hide properties that are left empty, not really what I was looking for. But you got it right, I want to change it from “Empty” to something like Null or else by default…
I don’t 'even know if it’s possible?

Yes, although if you know the correct element to target, you can change it to do what you want, like change the content (probably). I think that is possible, but so far I can’t even get it to hide. I’ll keep trying. (edit: oh I was editing the CSS for the wrong vault. I can make it do things now, but it targets all my properties…)

So here is my test that is not working, but kind of getting close. I’ve been trying “.metadata-property” and “.metadata-property-value” and other variations, but I am no CSS expert. Hopefully someone better has some clues!

Here is an example of how you could potentially replace an element:

.metadata-property-value:has([placeholder="Empty"]){
    display:none;
}
.metadata-property:has([placeholder="Empty"]):after{
    content: "TEST";
}

screenshot_2024-10-08_06-00-13

But I don’t know why it’s targeting all my properties, including ones that don’t have the placeholder=Empty component. I’m doing tests by trying different elements like this to see which ones change by moving them to the right:

.metadata-property-value:has([placeholder="Empty"]){
    margin-left: 50px;
}

Oddly, all my properties are being targeted except tags.

screenshot_2024-10-08_06-00-52

I swear this was there at some point. Honest! :sweat_smile: I’m only seeing Empty now as well.


This seems to take care of the user created properties. Replace the content: "" part with whatever you like.

.metadata-property .metadata-input-longtext:empty:before {
    content: "👻🕷️🎃";
    color: var(--text-faint);
}

Screenshot 2024-10-09 072646

When you enter a value, whatever the content is, is removed.

Screenshot 2024-10-09 074403


Obsidian’s default Properties are a bit different, and using similar for those produces some unwanted results:

.metadata-property .multi-select-input:empty:before {
    content: "abcd";
}

Screenshot 2024-10-09 073109

I’ll have another look at it later if I have time.

I’ll move this to the CSS category at this point and we can whittle away at it.

2 Likes

Thank you so much for your help Rigmarole and Ariehen, you guys rock!
I actually just needed that for my own created properties for now, so that is perfect to me now! :smiley: I adjusted the color font with some grey to match the original faint grey

    content: "0";
    color: #666666; 
}

Another random quick and niche question now that I’m here, would you know how to remove/hide the icon “Properties view: Show all properties”?


I know I can add/remove the one for the file property, but I can’t figure out the other way around. It looks like the file property view is dependent on the all property view; which also makes me wondering who actually find a use of the all properties view :sweat_smile:
So if you had snippet to hide it I would be much grateful to make my space a little cleaner

I’m not sure what you mean by that part. But for that icon, can’t you right-click on it, and “Close”? Or am I looking at the wrong one?

Also in Core Plugins settings, would this hide that one for you?

1 Like

But for that icon, can’t you right-click on it, and “Close”? Or am I looking at the wrong one?

That’s what I simply thought, but if you try yourself to right-click on All Property view, close it, then restart the app, it will come back where it was…

Also in Core Plugins settings, would this hide that one for you?

And there too, if you try to untoggle the “Property view” it will remove both the file and all property view…So that’s why I said that the file Property view seems to be dependent on the All Property view, but not the other way around.

Oh I see. I didn’t even know about that file view. I had only been using the properties at the top of each note. I might want to use this and hide all properties in the note.

And now I do see what you mean. The “All properties” view keeps auto-opening.

Whether you find a CSS solution or not, you might want to consider opening a feature request asking for that view to stay closed.

I might want to use this and hide all properties in the note.

Yup, so much more surface to work on in the notes by putting it on the right

I’m glad I could teach a feature to a moderator hahaha
I’ll try to open a request feature
Thank you again!

PS: not sure if I should open a new top in feature request or if I can change it from here?

1 Like

New top thread please, so it can be focused.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.