Updated:

Common components (Java)

GoalComponent
Namecustom_name
Description lineslore
Enchantmentsenchantments
Never breaksunbreakable
Enchantment glint onlyenchantment_glint_override
Stack sizemax_stack_size

A named sword with lore

/give @p diamond_sword[custom_name={"text":"Hero's Sword","color":"gold","italic":false},lore=[{"text":"Passed down in the kingdom","color":"gray","italic":false}],enchantments={sharpness:5,unbreaking:3}] 1

This is the Java 1.21.5+ format; earlier versions differ, so use the give generator for them. Names and lore are italic by default; "italic":false makes them upright. More on colors in item name colors.

Glint without enchantments

/give @p nether_star[enchantment_glint_override=true,custom_name="Special Ticket"] 1

Shiny but with no effect, good for event prizes and tickets.

Detect a custom item

For "only players with a ticket may pass", tag the item with custom_data and check for it:

/give @p paper[custom_data={ticket:1b},custom_name="Entry Ticket"] 1
/execute as @a if items entity @s weapon.mainhand paper[custom_data~{ticket:1b}] run say I have a ticket

Checking the name also works, but anyone can copy a name with an anvil; custom_data cannot be faked that way. /clear can remove the item by the same tag.

Bedrock Edition

Bedrock /give cannot set names, lore or enchantments above the maximum. It can set a few behaviors:

/give @p diamond_pickaxe 1 0 {"minecraft:can_destroy":{"blocks":["stone"]},"minecraft:keep_on_death":{}}

Available fields include can_destroy, can_place_on, keep_on_death and item_lock. Name items with an anvil.

Common questions

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.